Sign inGet started

dbt

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.

Governed metrics in your data stack

dbt Semantic Layer (MetricFlow) allows you to centrally define a set of metrics right alongside your dbt models. You can then consume then in Deepnote and use them for deeper data analysis.

  • Trust your numbers. Define your metrics centrally. They’re referenced dynamically from a single source, so you get consistent results.
  • Improve access to data. Let non-technical business users self-serve metrics so they can make trusted decisions faster.

Example use-case

Let's say the Senior Manager of Business Analytics intends to scrutinize the profits from the previous quarter, on a weekly basis, grouped by product category and further divided according to the sales teams. In the past, they'd need to have a thorough understanding of the data schemas, along with the skill to construct rather intricate SQL queries. Besides, even if they are an SQL whiz, consistency in constructing the query is not guaranteed - there's a high chance they might derive an incorrect answer.

If their data team is employing the dbt Semantic Layer (MetricFlow), they have a much simpler route. They can create a block in Deepnote, specify the "profits" metric, the time granularity, and the relevant product category, all without the need for sophisticated SQL knowledge. The necessity to work with complex SQL and adjust "group by" statements is eliminated if they decide to switch their view to daily profits, or include an additional dimension for segmentation.

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.
  • Bringing metadata into Deepnote. (coming soon) Review model, table and column descriptions and tests, as well as data freshness.

Prerequisites

In Deepnote, you can use the following data sources with dbt Semantic Layer:

  • Snowflake
  • BigQuery
  • Redshift

Setting up the integration

When setting up the integration, enable the semantic layer option, and fill in your Access URL, Environment ID and Service token.

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, powered by MetricFlow. 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 warehouse integration.

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

Querying the semantic layer

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

select * from {{ ref('orders') }}