Skip to main content

Starburst & Trino setup

Vendor-supported plugin

Certain core functionality may vary. If you would like to report a bug, request a feature, or contribute, you can check out the linked repository and open an issue.

Overview of dbt-trino

  • Maintained by: Starburst Data, Inc.
  • Authors: Marius Grama, Przemek Denkiewicz, Michiel de Smet
  • GitHub repo: starburstdata/dbt-trino
  • PyPI package: dbt-trino
  • Slack channel: #db-presto-trino
  • Supported dbt Core version: v0.20.0 and newer
  • dbt Cloud support: Not Supported
  • Minimum data platform version: n/a

Installing dbt-trino

pip is the easiest way to install the adapter:

pip install dbt-trino

Installing dbt-trino will also install dbt-core and any other dependencies.

Configuring dbt-trino

For Trino-specifc configuration please refer to Trino Configuration

For further info, refer to the GitHub repository: starburstdata/dbt-trino

Set up a Trino or Starburst Target

Trino or Starburst targets should be set up using the following configuration in your profiles.yml file.

See all possible profile configuration options here.

~/.dbt/profiles.yml
trino:
target: dev
outputs:
dev:
type: trino
method: none # optional, one of {none | ldap | kerberos | oauth | jwt | certificate}
user: [user]
password: [password] # required if method is ldap or kerberos
database: [database name]
host: [hostname]
port: [port number]
schema: [your dbt schema]
threads: [1 or more]
retries: [1 or more] # default: 3
http_scheme: [http or https]
session_properties:
[some_session_property]: [value] # run SHOW SESSION query to get current session properties

Incremental models

Incremental strategies supported by the adapter are:

  • append (default incremental strategy) - append only adds the new records based on the condition specified in the is_incremental() conditional block.
  • delete+insert - Through the delete+insert incremental strategy, you can instruct dbt to use a two-step incremental approach. It will first delete the records detected through the configured is_incremental() block and re-insert them.
  • merge - Through the merge incremental strategy, dbt-trino constructs a MERGE statement which inserts new and updates existing records based on the unique key (specified by unique_key). If your unique_key is not actually unique, the delete+insert strategy can be used instead. Note that some connectors in Trino have limited or no support for MERGE.

Configuration

A dbt-trino profile can be configured to run against Trino or Starburst using the following configuration:

OptionDescriptionRequired?Example
methodThe Trino authentication method to useOptional (default is none, supported methods are ldap, kerberos, jwt, oauth or certificate)none or kerberos
userUsername for authenticationOptional (required if method is none, ldap or kerberos)commander
passwordPassword for authenticationOptional (required if method is ldap)none or abc123
keytabPath to keytab for kerberos authenticationOptional (may be required if method is kerberos)/tmp/trino.keytab
krb5_configPath to config for kerberos authenticationOptional (may be required if method is kerberos)/tmp/krb5.conf
principalPrincipal for kerberos authenticationOptional (may be required if method is kerberos)trino@EXAMPLE.COM
service_nameService name for kerberos authenticationOptional (default is trino)abc123
jwt_tokenJWT token for authenticationOptional (required if method is jwt)none or abc123
client_certificatePath to client certificate to be used for certificate based authenticationOptional (required if method is certificate)/tmp/tls.crt
client_private_keyPath to client private key to be used for certificate based authenticationOptional (required if method is certificate)/tmp/tls.key
http_headersHTTP Headers to send alongside requests to Trino, specified as a yaml dictionary of (header, value) pairs.OptionalX-Trino-Client-Info: dbt-trino
http_schemeThe HTTP scheme to use for requests to TrinoOptional (default is http, or https for method: kerberos, ldap or jwt)https or http
certThe full path to a certificate file for authentication with trinoOptional
session_propertiesSets Trino session properties used in the connectionOptionalquery_max_run_time: 4h
databaseSpecify the database to build models intoRequiredanalytics
schemaSpecify the schema to build models into. Note: it is not recommended to use upper or mixed case schema namesRequiredpublic
hostThe hostname to connect toRequired127.0.0.1
portThe port to connect to the host onRequired8080
threadsHow many threads dbt should useOptional (default is 1)8
prepared_statements_enabledEnable usage of Trino prepared statements (used in dbt seed commands)Optional (default is true)true or false
retriesConfigure how many times a database operation is retried when connection issues ariseOptional (default is 3)
timezoneThe time zone for the sessionOptional (defaults to the client side local timezone)Europe/Brussels
0