How to Connect Starburst or Trino Using dbt?

This is some text inside of a div block.
Published
May 2, 2024
Author

How to Install the dbt-trino Adapter Plugin?

Installing the dbt-trino adapter plugin is the first step in connecting Starburst or Trino to dbt. This plugin enables dbt to interact with the Starburst or Trino clusters. The installation process is straightforward and can be done using pip, a package installer for Python.

pip install dbt-trino

This command installs the dbt-trino adapter plugin. Once installed, you can use dbt with your Starburst or Trino clusters.

  • dbt-trino: This is the adapter plugin that allows dbt to interact with Trino or Starburst.
  • pip: This is a package installer for Python. It is used here to install the dbt-trino adapter plugin.

How to Configure Connection Details in profiles.yml?

After installing the dbt-trino adapter, the next step is to configure the connection details in the profiles.yml file. This file contains the necessary information for dbt to connect to your Starburst or Trino clusters.

profiles.yml:
target: dev
outputs:
dev:
type: trino
host: your-cluster-hostname
port: your-cluster-port
user: your-username
password: your-password
database: your-database
schema: your-schema

This code block represents a sample configuration in the profiles.yml file. Replace the placeholders with your actual connection details.

  • host: The hostname of your Starburst or Trino cluster, without the http:// or https:// prefix.
  • port: The port to connect to your cluster, typically 443 for TLS-enabled clusters.
  • user: The username to log in to your cluster. For Starburst Galaxy, include the role as a suffix.
  • password: The user's password.
  • database: The name of a catalog in your cluster.
  • schema: The name of a schema within the specified catalog.

How to Ensure Proper Access to Catalog and Schema?

When selecting the catalog and schema, it's crucial to ensure that the user has read and write access to both. These selections set the default location for materialized tables and views but do not limit querying other areas.

No specific code is required for this step. It involves checking access permissions in your Starburst or Trino cluster.

Ensuring proper access to the catalog and schema is more of a configuration and permission setting task rather than a coding task. It involves checking and setting permissions in your Starburst or Trino cluster.

  • catalog: This is the name of a catalog in your cluster. You should have read and write access to it.
  • schema: This is the name of a schema within the specified catalog. You should also have read and write access to it.

How to Specify a Role for Starburst Enterprise Cluster?

If you are connecting to a Starburst Enterprise cluster with access controls, you must specify a role using the format catalog: role in your profiles.yml file.

profiles.yml:
target: dev
outputs:
dev:
type: trino
host: your-cluster-hostname
port: your-cluster-port
user: your-username
password: your-password
database: your-database
schema: your-schema
role: your-role

This code block represents a sample configuration in the profiles.yml file for a Starburst Enterprise cluster. The role field is added to specify the user's role.

  • role: This is the user's role in the Starburst Enterprise cluster. It is specified using the format catalog: role.

How to Configure Connection Details in dbt Cloud UI?

For dbt Cloud users, there's no need to create a profiles.yml file. Instead, you can configure the connection details directly in the dbt Cloud UI.

No specific code is required for this step. It involves configuring settings in the dbt Cloud UI.

Configuring connection details in dbt Cloud UI is a straightforward process. It involves navigating to the settings page in dbt Cloud and entering your connection details.

  • dbt Cloud UI: This is the user interface of dbt Cloud. You can configure your connection details here instead of creating a profiles.yml file.

Keep reading

See all