Skip to main content

dbt integration

If you use dbt Cloud, Hex can use metadata from your dbt project to populate the schema browser, including:

  • Model, source and column descriptions and tests
  • When the model was last updated
  • Any source freshness tests
  • Links to the relevant page of your deployed docs site in dbt Cloud

Once the dbt integration is configured, tables in the schema browser that are part of a model or defined as a source in dbt will display their most recent job execution date, source freshness, and the status of any tests configured on the model.

This metadata will be refreshed automatically for all tables in a data connection associated with dbt models or sources, and only needs to be configured once per connection.

tip

If a new table has been added to a data connection, you will need to refresh the Schema browser in order to see the new table.

Configuring the dbt integration#

Each data connection can be individually configured to integrate with dbt. From the connection settings, you can toggle on the dbt integration and provide your credentials. Hex will automatically find the relevant schemas and tables as modeled in dbt.

Enable the dbt integration for your data connection.

Account ID and Project ID can be most easily found in the URL of the "Jobs" page for your project, following this structure: https://cloud.getdbt.com/#/accounts/<ACCOUNT_ID>/projects/<PROJECT_ID>/jobs/

The service token must be have both the "Metadata Only" and "Job Admin" permissions. To generate a service token:

  1. Head to the Account Settings view in dbt Cloud.
  2. Click the Service Account tokens page and select "New Token".
  3. Name the token ("Hex dbt integration" is a good starting point), and add the "Metadata Only" and "Job Admin" permissions.
  4. Add the the token to the Hex connection.

Note: After a token is generated, it won't be able to be viewed again so either add it to Hex immediately, or store it somewhere very safe!

Supported connection types#

  • BigQuery
  • Databricks
  • PostgreSQL
  • Redshift
  • Snowflake