Skip to main content

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.

Metadata

Release files for in-metricflow 0.205.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for in-metricflow 0.205.0
File Size Uploaded
in_metricflow-0.205.0.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for in-metricflow 0.205.0
File Interpreter ABI Platform
in_metricflow-0.205.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / in_metricflow-0.205.0.tar.gz

Download URL in_metricflow-0.205.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
49387f17f533d69db8ec436fc790ebda369636a6051798ba9804ac9795076643
BLAKE2b-256 checksum
How to use checksums
6b9dd0ce682df033c0d61fc48178a1ecdad2385a8b261d626d7394a294a0bb0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.6

Release files / in_metricflow-0.205.0-py3-none-any.whl

Download URL in_metricflow-0.205.0-py3-none-any.whl
Size 372.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b29e80b43609f7a8fce246665dd7f1e9fb996263eccaa7059f9fa4ef46720146
BLAKE2b-256 checksum
How to use checksums
629ede7d440fa1af3bfab55b65cbb1f33160f5d067a2288b248fe2994b85c15c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.205.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page