Skip to main content

Easily convert an out of date dbt 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-metrics-converter

Upgrading to dbt v1.6 spec

  1. Navigate to the root of your dbt project.
  2. pip install dbt-metrics-converter. Note that the converter requires dbt-core==1.5. You may need to update the version range for the dbt_metrics package.
  3. Run dbtc 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.
  4. Semantic models and metrics files will be created in the semantic_models and metrics directories. Move these folders into your model path.
  5. Delete the metrics package, move the old metrics configs out of your model path, or delete them.

Testing your metrics in dbt v1.6

  1. Upgrade to dbt v1.6, and pip install dbt-metricflow
  2. Remove the old metrics package from your dbt_packages and run dbt clean && dbt deps.
  3. Run dbt parse to generate a semantic manifest
  4. View the metrics in your dbt project by running mf list metrics
  5. Run mf validate-configs —skip-dw to validate metrics configs.
  6. 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 or metrics.develop they won’t work without the dbt_metrics package

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_metrics_converter-0.1.5.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

dbt_metrics_converter-0.1.5.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file dbt_metrics_converter-0.1.5.1.tar.gz.

File metadata

  • Download URL: dbt_metrics_converter-0.1.5.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.16 Darwin/22.5.0

File hashes

Hashes for dbt_metrics_converter-0.1.5.1.tar.gz
Algorithm Hash digest
SHA256 60ab8f78b22940105c88c0b37f3064f5d502be5f7f16d51efdecb294f10d5b87
MD5 a4d70c32fb3a0a6721f3a3e7a79c28b7
BLAKE2b-256 2f9e624318dcd8c77398f83e798c23689f42a1f08fea95ea9d59fd714e5f1f6c

See more details on using hashes here.

File details

Details for the file dbt_metrics_converter-0.1.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for dbt_metrics_converter-0.1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c728a18eff228e414d612b2e14f2af93b42814050ce9cdffd225fddce04d04ed
MD5 1ba92f9584ade44135d2a00f91f44a80
BLAKE2b-256 3c26dfac7f72b20e5b94dd154885f1ed336a3ab54572455374a4ff33d1a95303

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page