{"id":6583,"library":"dbt-trino","title":"dbt-trino","description":"The dbt-trino adapter allows dbt (data build tool) to connect to Trino, a distributed SQL query engine. It enables analytics engineers to transform data across various data sources that Trino can access, leveraging dbt's capabilities for modularity, testing, and documentation. The current version is 1.10.1, and it typically releases new versions in alignment with `dbt-core` major and minor releases.","status":"active","version":"1.10.1","language":"en","source_language":"en","source_url":"https://github.com/starburstdata/dbt-trino","tags":["dbt","data build tool","trino","sql","data warehousing","etl","data transformation"],"install":[{"cmd":"pip install dbt-core dbt-trino","lang":"bash","label":"Recommended installation for dbt-core v1.8+"},{"cmd":"pip install dbt-trino","lang":"bash","label":"Minimal adapter installation"},{"cmd":"pip install 'trino[external-authentication-token-cache]' keyring","lang":"bash","label":"For OAuth2 with token caching"}],"dependencies":[{"reason":"Required for dbt functionality; explicitly install alongside adapter since dbt-core v1.8.","package":"dbt-core","optional":false},{"reason":"Python client for Trino connectivity; `[external-authentication-token-cache]` extra is useful for OAuth2.","package":"trino","optional":false},{"reason":"Recommended for caching OAuth2 tokens over multiple dbt invocations.","package":"keyring","optional":true}],"imports":[{"note":"dbt adapters like dbt-trino are typically not imported directly in Python code for end-user functionality. Interaction is primarily through the dbt CLI and YAML configuration files like `profiles.yml`.","symbol":"dbt-trino","correct":"N/A (Adapter is configured via profiles.yml)"}],"quickstart":{"code":"import os\n\n# 1. Install dbt-trino (already covered in install instructions)\n# pip install dbt-core dbt-trino\n\n# 2. Initialize a dbt project (if you don't have one)\n# dbt init my_trino_project\n\n# 3. Configure your profiles.yml (usually in ~/.dbt/profiles.yml)\n# Example profiles.yml content for a basic Trino connection:\n# my_trino_project:\n#   target: dev\n#   outputs:\n#     dev:\n#       type: trino\n#       method: none  # Or 'ldap', 'jwt', 'oauth', etc.\n#       user: admin\n#       password: \"\"  # Required if method is ldap/kerberos, otherwise optional\n#       catalog: hive_catalog # Your Trino catalog (e.g., hive, iceberg)\n#       host: localhost\n#       port: 8080\n#       schema: default_schema # Your Trino schema (database)\n#       threads: 4\n#       http_scheme: http # or https\n\n# For OAuth2, ensure 'trino[external-authentication-token-cache]' and 'keyring' are installed\n# and set method: oauth in profiles.yml\n\n# 4. Create a simple dbt model (e.g., models/my_model.sql)\n# -- models/my_model.sql\n# {{ config(materialized='view') }}\n# SELECT\n#   1 as id,\n#   'hello' as message\n#\n\n# 5. Run your dbt models (execute in your terminal in the dbt project directory)\n# dbt debug --target dev\n# dbt run --target dev\n# dbt test --target dev\n","lang":"python","description":"To quickly get started with dbt-trino, first ensure both `dbt-core` and `dbt-trino` are installed. Then, initialize a dbt project using `dbt init` and configure your `profiles.yml` file to define the connection to your Trino cluster. The example shows a basic configuration with no authentication, which can be extended for LDAP, JWT, or OAuth2. After configuration, you can create a simple SQL model and run it using `dbt run`."},"warnings":[{"fix":"Ensure your installation command is `pip install dbt-core dbt-trino`. If upgrading, verify both packages are installed to compatible versions.","message":"Starting with dbt-core v1.8, users must explicitly install both `dbt-core` and `dbt-trino` (e.g., `pip install dbt-core dbt-trino`). Prior to v1.8, installing the adapter implicitly installed `dbt-core`, but this behavior changed to decouple core and adapter versions.","severity":"breaking","affected_versions":"dbt-core >= 1.8"},{"fix":"Consult Trino documentation for SQL function equivalents. Use `dbt_utils.pivot` macro or manual aggregation for pivoting. Be mindful of explicit casting for type comparisons.","message":"Trino's SQL dialect can differ from other data warehouses, requiring query modifications. Common differences include function names (e.g., `IFF()` in Snowflake is `IF()` in Trino, `NVL()` is `COALESCE()`, `DATEADD()` is `DATE_ADD()`) and behavior of implicit type coercion. Direct `PIVOT` functionality is also generally not available in Trino SQL.","severity":"gotcha","affected_versions":"All"},{"fix":"If `merge` fails, consider using the `delete+insert` incremental strategy instead, or verify your specific Trino connector's `MERGE` capabilities.","message":"The `merge` incremental strategy (used for upserts) relies on underlying Trino connector support for `MERGE` statements. Some Trino connectors have limited or no `MERGE` support, which can lead to errors.","severity":"gotcha","affected_versions":"All"},{"fix":"Set `on_table_exists='drop'` in your model configuration or `dbt_project.yml` when working with AWS Glue.","message":"When using AWS Glue as a metastore with Trino, the `on_table_exists='rename'` configuration for table materialization is not supported and will result in a `NOT_SUPPORTED` error. Glue does not support table renames.","severity":"gotcha","affected_versions":"All (when using AWS Glue with `on_table_exists='rename'`)"},{"fix":"Manually delete the expired token from your `keyring` storage. Ensure `keyring` and the `trino[external-authentication-token-cache]` extra are correctly installed and configured. Monitor for upstream fixes in `dbt-trino` or `trino-python-client`.","message":"When using OAuth2 authentication, users have reported `Error: header info didn't have x_token_server` after tokens expire. This indicates that automatic token refresh or re-prompting might not occur as expected, requiring manual intervention.","severity":"gotcha","affected_versions":"dbt-trino >= 1.8.1 (reported for 1.8.*)"},{"fix":"Review your `dbt_project.yml` and model configurations for adherence to dbt's expected YAML schema. Use the `--warn-error-options '{\"warn\": [\"Deprecations\"]}'` flag to explicitly treat new deprecation warnings as warnings, rather than errors if `--warn-error` is enabled.","message":"dbt-core v1.10 introduces new deprecation warnings for custom inputs such as unrecognized resource properties, configurations, top-level keys in YAML files, duplicate YAML keys, and unexpected Jinja blocks. Projects migrating to v1.10 or later may encounter these warnings.","severity":"deprecated","affected_versions":"dbt-core >= 1.10"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}