Skip to main content

Translates a simple metric definition into reusable SQL and executes it against the SQL engine of your choice.

Project description

metricflow logo

Build and maintain all of your metric logic in code.


Welcome to MetricFlow

See our latest updates in the Metricflow Changelog!

MetricFlow is a semantic layer that makes it easy to organize metric definitions. It takes those definitions and generates legible and reusable SQL. This makes it easy to get consistent metrics output broken down by attributes (dimensions) of interest.

The name comes from the approach taken to generate metrics. A query is compiled into a query plan (represented below) called a dataflow that constructs metrics. The plan is then optimized and rendered to engine-specific SQL.



MetricFlow provides a set of abstractions that help you construct complicated logic and dynamically generate queries to handle:

  • Multi-hop joins between fact and dimension sources
  • Complex metric types such as ratio, expression, and cumulative
  • Metric aggregation to different time granularities
  • And so much more

To get up and running with your own metrics, you should rely on MetricFlow’s documentation.

Licensing

MetricFlow is distributed under a Business Source License (BUSL-1.1). For details on our additional use grant, change license, and change date please refer to our licensing agreement.

Getting Started

Install MetricFlow

MetricFlow can be installed from PyPi for use as a Python library with the following command:

pip install dbt-metricflow

MetricFlow currently serves as a query compilation and SQL rendering library, built to work in conjunction with a dbt project. As such, using MetricFlow requires a working dbt project and a dbt adapter. We provide the dbt-metricflow bundle for this purpose. You may choose to install other adapters as optional extras from dbt-metricflow.

You may need to install Postgres or Graphviz. You can do so by following the install instructions for Postgres or Graphviz. Mac users may prefer to use brew: brew install postgresql or brew install graphviz.

Tutorial

The best way to get started is to follow the tutorial steps, which you can access by running:

mf tutorial

Note: this must be run from a dbt project root directory.

Resources

Contributing and Code of Conduct

This project will be a place where people can easily contribute high-quality updates in a supportive environment.

Please read our code of conduct before diving in.

To get started on direct contributions, head on over to our contributor guide.

License

MetricFlow is source-available software.

Version 0 to 0.140.0 was covered by the Affero GPL license. Version 0.150.0 and greater is covered by the BSL license..

MetricFlow is built by dbt Labs.

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

metricflow-0.207.3.tar.gz (665.2 kB view details)

Uploaded Source

Built Distribution

metricflow-0.207.3-py3-none-any.whl (864.8 kB view details)

Uploaded Python 3

File details

Details for the file metricflow-0.207.3.tar.gz.

File metadata

  • Download URL: metricflow-0.207.3.tar.gz
  • Upload date:
  • Size: 665.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for metricflow-0.207.3.tar.gz
Algorithm Hash digest
SHA256 e03936b4855a44cdb05ff81269c1440e9d1c90fef9627fc7d3f3350038092689
MD5 6e90cc7c401bbb67da02fa4fd87a0a67
BLAKE2b-256 f6cbb7b891c37c255c62c9623bb78c57c8ad414a8c4b51c2c2e99ead7279767b

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricflow-0.207.3.tar.gz:

Publisher: cd-push-metricflow-to-pypi.yaml on dbt-labs/metricflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file metricflow-0.207.3-py3-none-any.whl.

File metadata

  • Download URL: metricflow-0.207.3-py3-none-any.whl
  • Upload date:
  • Size: 864.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for metricflow-0.207.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a0a3bec49bad2c688ad1c96d9e132fca95b34beff8cb418783f37d1823e4462f
MD5 8e396dcee08229d553048c57be4bb0fe
BLAKE2b-256 c176d4e3423e313c68cb95538bf25fb1a6c54cd5dc8318c61411eb483751f1b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for metricflow-0.207.3-py3-none-any.whl:

Publisher: cd-push-metricflow-to-pypi.yaml on dbt-labs/metricflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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