Skip to main content

dbt Metrics cells

dbt Metrics cells allow users of all technical levels to pull in data backed by consistent, governed metrics, and be confident in their results.

Pre-requisites

To use the dbt Metrics cell, first ensure:

  • You have enabled the dbt Server integration as outlined here.
  • You are using dbt v1.2 or higher.
  • You have the metrics package installed in your project (v0.3.1 or higher), and at least one metric defined in your dbt project.

Configure dbt Metrics cells

First, add a dbt Metrics cell to your project (dbt Metrics cells are grouped with the other Transform type cells). Then, select a metric of interest via the +Add button on the left of the cell. Multiple metrics can be added, if desired.

From here, you can specify the time grain and start/end dates for the returned data. You can also specify additional dimensions which are compatible with the selected metric. Optionally, you can configure secondary calculations like a period-over-period calculation or running total. Once you have configured the dbt Metrics cell, execute the cell to retrieve the results of the query.

Use dbt Metrics results in downstream cells

dbt Metrics cells return a pandas DataFrame with a default naming scheme of metric_result_n. This DataFrame can be used in downstream cells anywhere a pandas DataFrame can be used. For example, dbt Metrics cell results can be: