# dbt-labs/metricflow

MetricFlow allows you to define, build, and maintain metrics in code.

Repository: https://github.com/dbt-labs/metricflow
Canonical: https://ross.abutalabs.com/products/metricflow
Homepage: https://docs.getdbt.com/docs/build/about-metricflow
Language: Python
License: Apache-2.0
License Family: permissive
Topics: data, analytics, metrics, pypi, business-intelligence, data-modeling, semantic-layer
Last push: 2026-08-24T18:39:05+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 98, longevity 100
- inputs: {"age_days": 1612, "days_push": 9, "days_rel": 14, "gap_med": 25.5, "n_releases_24m": 11}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1768, forks 199 (observed 2026-08-28T04:05:33.706421+00:00)

## What it is
MetricFlow is a Python semantic layer library from dbt Labs that lets you define, build, and maintain business metrics in code. It compiles metric definitions into optimized, engine-specific SQL, handling multi-hop joins, ratio/expression/cumulative metrics, and time-granularity aggregation.

## Use cases
- define business metrics as code in yaml
- generate consistent sql queries from metric definitions
- build a semantic layer on top of a data warehouse
- query metrics with dimensions and time granularities
- avoid duplicated metric logic across bi tools
- compute ratio and cumulative metrics from warehouse data

## When to choose
- you use dbt and want centralized, version-controlled metric definitions
- you need consistent metric logic across multiple BI tools and consumers
- you want automated SQL generation with multi-hop joins and complex metric types
- you target Snowflake, BigQuery, Databricks, Postgres, or Redshift

## When to avoid
- you need a standalone BI dashboard or visualization tool
- you don't use dbt or a SQL data warehouse
- you need real-time streaming metrics rather than warehouse queries
- you want a no-code metrics interface for non-technical users

## Facets
- artifact type: library
- maturity: active
- function: data-science, analytics, cli, developer-tools
- domain: analytics, big-data, developer-tools
- platform: python, cli, cross-platform
- tags: semantic-layer, metrics-as-code, sql-generation, dbt, business-intelligence, data-modeling, data-engineering

## Member repositories
- dbt-labs/metricflow (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:33.706421+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:26:09.433479+00:00, confidence not recorded.
  - readme: https://github.com/dbt-labs/metricflow (fetched 2026-08-28T04:05:33.706421+00:00, sha f5032c0b4863)
  - homepage: https://docs.getdbt.com/docs/build/about-metricflow (fetched 2026-08-29T11:04:42.394073+00:00, sha 4b8002dd5d24)
  - site_page: https://docs.getdbt.com/docs/dbt-versions/dbt-release-tracks?version=2.0 (fetched 2026-08-29T11:04:42.403501+00:00, sha ee97df5e3f4e)
  - site_page: https://docs.getdbt.com/docs/introduction (fetched 2026-08-29T11:04:42.405563+00:00, sha c63f73658ab6)
  - site_page: https://docs.getdbt.com/docs/dbt-apis/overview (fetched 2026-08-29T11:04:42.407331+00:00, sha dc0461646565)
  - site_page: https://docs.getdbt.com/docs/dbt-versions/release-notes (fetched 2026-08-29T11:04:42.408871+00:00, sha db3cfb1a642a)
  - site_page: https://docs.getdbt.com/docs/faqs (fetched 2026-08-29T11:04:42.411701+00:00, sha 6a1e83a5bfcd)
  - site_page: https://docs.getdbt.com/docs/dbt-support (fetched 2026-08-29T11:04:42.413445+00:00, sha 17e279f54ef7)
  - site_page: https://docs.getdbt.com/docs/dbt-licensing (fetched 2026-08-29T11:04:42.415220+00:00, sha 6c34c0540c7c)
  - site_page: https://docs.getdbt.com/docs/dbt/get-started-dbt (fetched 2026-08-29T11:04:42.417069+00:00, sha 7e642f2cc4cf)
- Data as of 2026-08-30T08:39:29.467469+00:00.
