Getting started

Deepnote documentation





What is dbt?

dbt enables analytics engineers to transform data in their warehouses by simply writing select statements. dbt handles turning these select statements into tables and views.

dbt does the T in ELT (Extract, Load, Transform) processes – it doesn’t extract or load data, but it’s extremely good at transforming data that’s already loaded into your warehouse.

Working with dbt in Deepnote

  • Using the transformed data. The most common use case is to build Deepnote notebooks based on the tables and views which are the results of the dbt jobs.
  • Prototyping dbt models. Deepnote excels at exploratory data analysis, which is often the foundation of defining and improving models. With the new Semantic layer integration, Deepnote can work directly with jinja SQL.
  • Exploring dbt metrics. Browse the most important metrics of your company and see what dimensions they can be broken down by.

Setting up the integration

To use the transformed data in your notebooks, you will only need an integration for your data warehouse. The rest of this section describes


To begin using dbt Semantic layer, you should:

  • Use Snowflake as a warehouse
  • Use dbt Cloud on the Team plan or Enterprise plan (not a single-tenant version)
  • Use dbt Core v1.0 or higher

Creating the integration

Available on Team and Enterprise plans

  1. Start by creating a Snowflake integration. If you already have one, you can edit its settings.
  2. Turn on the toggle for dbt Semantic layer, and fill in the three fields:
    1. dbt service token – with Metadata Only (or higher) permissions
    2. dbt primary Job ID – any job which has a production environment defined, and which ran at least once
    3. Proxy Server URL – a url you can find in your dbt environment settings. Add it without the leading https://.

Note – the Snowflake credentials in Deepnote must match the ones used in the linked dbt job production environment.

Running queries

Now you can add SQL blocks to your notebooks and run queries which include jinja.

You can verify it works by running:

select '{{ dbt_version }}'

Semantic layer

An exceptionally powerful capability of dbt is its Semantic layer. It enables you to use your pre-defined metrics in Deepnote's notebooks.

Exploring metrics

schema explorer.png

In the right sidebar, open the Integrations tab and press View schema on the box with the connected Snowflake integration.

Under metrics layer, you will be able to browse the available metrics and their dimensions.

Querying metrics

Use dbt syntax to query your metrics. An example query:

select * from {{ metrics.metric(
            dimensions=['revenue_type']) }}
© 2022 Deepnote. All rights reserved.