Integrate with dbt

ThoughtSpot’s dbt integration allows you to easily provide your existing dbt models and automatically create ThoughtSpot worksheets, which you can use to search your data.

dbt takes your raw data in your data warehouse and transforms and validates it. ThoughtSpot’s dbt integration connects users to their cloud data warehouse, integrates with your dbt models using an API key or zip file, and generates the relationships between the tables defined in the dbt model that you select. Then, ThoughtSpot creates new worksheets, based on the relationships between the tables. These worksheets provide user-friendly logical views of your complex datasets. Users can use these worksheets to easily search their complex data. This process may replace existing dbt tables you imported into ThoughtSpot, but it will not replace existing worksheets.

Integration with dbt is certified only for Snowflake connections.

Prerequisites

Before you can integrate with dbt, you must satisfy the following prerequisites

  • Create a connection to your external cloud data warehouse. This cloud data warehouse must contain the tables that are created from your dbt models.

  • If you connect to dbt via dbt cloud, you need the API key, Account ID, and Project ID:

    API key

    This is also called the API token in dbt. To find this token, navigate to your Account Settings page in dbt cloud. Click on the Service Account tokens page, and generate a new token.

    Account ID

    Your default dbt Cloud account ID. Find your account ID in your dbt Cloud URL, after you log in. For example, if your URL is https://cloud.getdbt.com/#/accounts/12345/projects/56789/dashboard, your account ID is 12345.

    Project ID

    Find your project ID in your dbt Cloud URL, after you log in. For example, if your URL is https://cloud.getdbt.com/#/accounts/12345/projects/56789/dashboard, your project ID is 56789.

  • Define the relationships in the dbt models. If you do not define the relationships, ThoughtSpot does not create tables or worksheets.

  • If you are using dbt cloud, execute the project with the GENERATE DOCS? option ON.

  • If you are using dbt core, execute the dbt docs generate command along with the dbt run command.

  • If you are using dbt core, you must connect to dbt using a zip file, which must contain the latest manifest.json and catalog.json files. By default, dbt stores these files under the <project name>/target folder.

Integrating with dbt

You can set up your dbt integration from the Data workspace. To integrate with dbt, follow these steps:

  1. Ensure that you have already created a connection to your external cloud data warehouse. This cloud data warehouse must contain the tables that are created from your dbt models.

  2. Select Data in the top navigation bar.

  3. Select Utilities in the side navigation bar.

  4. Under dbt Integration, select Open dbt integration wizard. The dbt integration wizard opens.

    dbt integration step 1
  5. Under Data warehouse, select the cloud data warehouse you would like to use from the dropdown, or search for it using the search bar in the dropdown.

  6. Under Database, select the database within the cloud data warehouse that you would like to use from the dropdown, or search for it using the search bar in the dropdown. This database must contain the tables that are created from your dbt models.

  7. Under Connect to dbt project, select either Via dbt cloud or Use a .zip file. If you are using dbt core, you must select Use a .zip file.

  8. If you select Via dbt cloud, fill in the following parameters:

    API key

    This is also called the API token in dbt. To find this token, navigate to your Account Settings page in dbt cloud. Click on the Service Account tokens page, and generate a new token.

    Account ID

    Your default dbt Cloud account ID. Find your account ID in your dbt Cloud URL, after you log in. For example, if your URL is https://cloud.getdbt.com/#/accounts/12345/projects/56789/dashboard, your account ID is 12345.

    Project ID

    Find your project ID in your dbt Cloud URL, after you log in. For example, if your URL is https://cloud.getdbt.com/#/accounts/12345/projects/56789/dashboard, your project ID is 56789.

  9. If you select Use a .zip file, click the Upload button, and add the zip file from your files. The zip file must contain the latest manifest.json and catalog.json files. By default, dbt stores these files under the <project name>/target folder.

  10. Select Next.

  11. On the next screen, select a dbt folder to import. ThoughtSpot lists the model names, paths, and the number of tables they have. Your model must have at least 2 tables. You must select at least 2 tables within the dbt folder. These tables must have relationships to each other.

    dbt integration step 2
  12. Select Next.

  13. On the next screen, select tables to import. By default, ThoughtSpot imports all tables in the folder. Deselect any tables you do not want to import.

    dbt integration step 3
  14. Select Finish.

  15. The Worksheets generated page appears. ThoughtSpot generates several worksheets from your dbt models.

    dbt integration step 4

    To inspect the worksheet details, click on any of the worksheet names.

    To search the data on the worksheet, select Search on this worksheet next to any worksheet.

  16. Select Exit.

  17. On the Data workspace home page, you can see the tables and worksheets that you just created from dbt.

    dbt integration view worksheets and tables
    This process may replace existing dbt tables you imported into ThoughtSpot, but it will not replace existing worksheets.
  18. If you click on any of the tables and worksheets you created, and then select Joins, you can see the joins ThoughtSpot created, based on the relationships in dbt.

  19. If there are any changes to the dbt models that you would like the ThoughtSpot worksheets and tables to reflect, you must run the dbt integration again, which creates a new set of worksheets.

Limitations

  • Currently, you can only connect to one dbt folder at a time.

  • The integration does not currently support relationships defined across folders.

  • You must select at least 2 tables within the dbt folder. These tables must have relationships to each other.