Easily convert out of date, or unsported metrics spec into the latest suported metrics spec in dbt
Project description
The dbt converter is a CLI tool that simplifies the process of migrating from the metrics spec supported in dbt v1.5 and earlier to the metrics specification supported in dbt ≥v1.6.
Installing dbt converter
pip install dbt-converter
Upgrading to dbt v1.6 spec
- Navigate to the root of your dbt project.
- Install the
dbt-converter
package using pip. Note that the converter requiresdbt-core==1.5
. You may need to update the version range for thedbt_metrics
package. - Run
dc convert-metrics
. The converter assumes you are in the root of your dbt project. Optionally, you can pass the project path-dbt-project-path path/to/dbt_project
. NOTE: All metrics must have a timestamp for the upgrade to run. If your metrics do not have a timestamp, add one before running the converter. - Semantic models and metrics files will be created in the
semantic_models
andmetrics
directories. Move these folders into your model path. - Delete the
metrics
package, move the old metrics configs out of your model path, or delete them.
Testing your metrics in dbt v1.6
- Upgrade to dbt v1.6, and
pip install dbt-metricflow
- Remove the old metrics package from your
dbt_packages
and rundbt clean && dbt deps
. - Run
dbt parse
to generate a semantic manifest - View the metrics in your dbt project by running
mf list metrics
- Run
mf validate-configs —skip-dw
to validate metrics configs. - To run a test query, run
mf query --metrics <metric_name>
Gotchas:
- Some packages, like fivetran/ad_reporting have metrics defined in them using the v1.5 spec, this may cause an error if you try to run your project after upgrading to v1.6
- Make sure to delete any calls of
metrics.calculate
ormetrics.develop
they won’t work without the dbt_metrics package
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dbt_metrics_converter-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2616cb6649d6dc2d4115caaebdb913565bf86d8344c18b83ec071c605ca182ad |
|
MD5 | 0664207d28944759cc029c8e5d3a99d1 |
|
BLAKE2b-256 | 7976e3620ae8739c32f7c69774b866d2e982df36c71039509456f1aeaeb06951 |
Close
Hashes for dbt_metrics_converter-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f595c0cb88061d2b53a16411b178bc0c027bc88b0193b070a168a17a5c12a40 |
|
MD5 | 1a252985d9e27f36be20e09a8417dd6c |
|
BLAKE2b-256 | c675558c46461f29cae6786cd38d3556e9c5f6682748120db6cd2631912865e5 |