dbt-trino

1.10.1 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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`.

import os

# 1. Install dbt-trino (already covered in install instructions)
# pip install dbt-core dbt-trino

# 2. Initialize a dbt project (if you don't have one)
# dbt init my_trino_project

# 3. Configure your profiles.yml (usually in ~/.dbt/profiles.yml)
# Example profiles.yml content for a basic Trino connection:
# my_trino_project:
#   target: dev
#   outputs:
#     dev:
#       type: trino
#       method: none  # Or 'ldap', 'jwt', 'oauth', etc.
#       user: admin
#       password: ""  # Required if method is ldap/kerberos, otherwise optional
#       catalog: hive_catalog # Your Trino catalog (e.g., hive, iceberg)
#       host: localhost
#       port: 8080
#       schema: default_schema # Your Trino schema (database)
#       threads: 4
#       http_scheme: http # or https

# For OAuth2, ensure 'trino[external-authentication-token-cache]' and 'keyring' are installed
# and set method: oauth in profiles.yml

# 4. Create a simple dbt model (e.g., models/my_model.sql)
# -- models/my_model.sql
# {{ config(materialized='view') }}
# SELECT
#   1 as id,
#   'hello' as message
#

# 5. Run your dbt models (execute in your terminal in the dbt project directory)
# dbt debug --target dev
# dbt run --target dev
# dbt test --target dev

view raw JSON →