MetricFlow Resources: 18 Docs, Repos and Tools Worth Using

· 8 MIN

TL;DR: MetricFlow is the open source engine behind the dbt Semantic Layer: you define metrics once in YAML and it writes the SQL. It has been Apache 2.0 licensed since version 0.209.0 (October 2025). Start with the dbt "About MetricFlow" docs, clone the jaffle-sl-template repo, and run mf tutorial; everything else below is for when you go deeper.

MetricFlow is a Python library from dbt Labs that turns metric definitions written in YAML (semantic models, entities, dimensions, measures and metrics) into SQL for your warehouse. Its README describes how: "metric requests are compiled into a dataflow-based query plan, which is then optimized and translated into engine-specific SQL." It handles multi-hop joins, ratio, cumulative and derived metrics, and rolling metrics up to different time grains. You can run it free with self-hosted dbt using the mf CLI, or through dbt's paid platform, where it powers the Semantic Layer APIs that Tableau, Power BI, Google Sheets, Hex and others query. The resources below are grouped by what you are trying to do, each with who it suits, what it costs and why it is worth the time. All links and versions were checked on November 6, 2026.

MetricFlow takes YAML metric definitions, builds a query plan and outputs warehouse SQL
FIG 01 — The same metric definition produces SQL for Snowflake, BigQuery, Databricks, Redshift or Postgres.

What is MetricFlow, and is it free and open source?

MetricFlow is free and open source under the Apache 2.0 license from version 0.209.0, published to PyPI on October 14, 2025. The license history is spelled out in the repo: versions up to 0.140.0 were AGPL, 0.150.0 to 0.208.2 were under the Business Source License, and 0.209.0 onward is Apache 2.0. That change is why older forum threads say you cannot embed MetricFlow commercially; that advice is now out of date.

What is not free is the hosted dbt Semantic Layer. According to dbt's pricing page, the free Developer plan is one seat and does not include the Semantic Layer; Starter is $100 per user per month with 5,000 queried metrics a month, and Enterprise tiers include 20,000 queried metrics a month. The MetricFlow commands docs confirm you need a Starter, Enterprise or Enterprise+ account to query metrics from downstream tools.

UseWhere it runsCostCommand prefix
Define and test metrics locallySelf-hosted dbt + dbt-metricflowFree (Apache 2.0)mf
Query metrics in dbt Studio IDE or dbt CLIdbt platformPaid plandbt sl
Serve metrics to BI tools via GraphQL/JDBCdbt platform Semantic LayerStarter and upAPIs

MetricFlow vs the dbt Semantic Layer

MetricFlow is the engine; the dbt Semantic Layer is the hosted service built on it. MetricFlow defines the spec for semantic models and metrics and generates the SQL. The Semantic Layer adds what a business needs to consume those metrics: GraphQL and JDBC APIs, caching through the dbt job scheduler, saved query exports and native integrations. If you only need consistent metric SQL inside your dbt project and CI, MetricFlow alone is enough. If you need Tableau or Google Sheets users pulling governed metrics, you need the Semantic Layer. Our semantic layer vs metrics layer guide covers the broader category.

Official docs: start here

These are the pages to read first. All are free.

Learning paths and guides

VIDEO · dbt Product Spotlight: dbt Semantic Layer (dbt Labs)

Code, repos and example projects

How do I get started with MetricFlow?

Install it into the same environment as your dbt project, then run the built-in tutorial:

# pick the extra for your warehouse adapter
python -m pip install "dbt-metricflow[dbt-snowflake]"

# from your dbt project root
mf tutorial

Then define a semantic model and a metric next to the dbt model it describes:

semantic_models:
  - name: orders
    model: ref('orders')
    defaults:
      agg_time_dimension: ordered_at
    entities:
      - name: order_id
        type: primary
      - name: customer
        type: foreign
        expr: customer_id
    dimensions:
      - name: ordered_at
        type: time
        type_params:
          time_granularity: day
    measures:
      - name: order_total
        agg: sum

metrics:
  - name: revenue
    label: Revenue
    type: simple
    type_params:
      measure: order_total

Parse, validate and query it:

dbt parse                     # refreshes semantic_manifest.json
mf validate-configs           # checks semantic models and metrics
mf list metrics
mf query --metrics revenue --group-by metric_time__month
Self-hosted users run mf commands locally, dbt platform users run the same commands with the dbt sl prefix
FIG 02 — Only the prefix and the validate command name differ.

Three gotchas from the docs that cost people an afternoon:

Also note that MetricFlow does not yet support dbt builtin functions or packages inside semantic definitions, per the About MetricFlow page.

Integrations and APIs

Standards and news: what changed recently

Most top-ranking pages on MetricFlow still describe the BSL era or predate OSI. When a guide tells you MetricFlow is source-available only, check its date.

Community

Start-here path for beginners

  1. Read About MetricFlow (30 minutes) and our glossary entries on semantic layers and metric definitions.
  2. Clone jaffle-sl-template, install dbt-metricflow with your adapter and run mf tutorial.
  3. Model one real table: one semantic model, one simple metric, one time dimension, plus a time spine.
  4. Add mf validate-configs to CI so broken metric YAML fails the pull request.
  5. Only then decide whether you need the paid Semantic Layer for BI tools, or whether local MetricFlow plus your existing dashboards is enough.

When MetricFlow is more than you need

MetricFlow pays off when you already run dbt and have several people defining the same metrics differently. It assumes a dbt project, an adapter, YAML modeling and someone to maintain it. Many small SaaS teams have none of that: their data is in one Postgres or MySQL database and they want answers, not a modeling layer. For that case, AI for Database connects straight to the database, answers questions in plain English with the SQL shown, and keeps the results on self-refreshing dashboards with alerts. Try AI for Database free at aifordatabase.com. If you do adopt MetricFlow, the dimension vs metric guide is a useful primer for the modeling vocabulary.

Frequently Asked Questions

What is MetricFlow?

MetricFlow is dbt Labs' open source metric engine. You describe semantic models and metrics in YAML, and it generates the SQL, including joins and time-grain rollups, for Snowflake, BigQuery, Databricks, Redshift or Postgres.

Is MetricFlow free and open source?

Yes. Version 0.209.0 and later are Apache 2.0 licensed. Earlier versions were AGPL and then BSL. The hosted dbt Semantic Layer that serves metrics to BI tools is a paid dbt platform feature.

How do I get started with MetricFlow?

Run pip install "dbt-metricflow[<your adapter>]" in your dbt environment, then mf tutorial from the project root. Clone jaffle-sl-template for working example YAML.

What is the difference between MetricFlow and the dbt Semantic Layer?

MetricFlow is the engine that defines metrics and compiles SQL. The dbt Semantic Layer is dbt's hosted service on top of it, adding GraphQL and JDBC APIs, caching, exports and BI integrations.

Does MetricFlow work without dbt Cloud?

Yes. Self-hosted dbt users install dbt-metricflow and use mf commands locally, including in CI. You lose the hosted APIs and integrations.

Which databases does MetricFlow support?

The dbt docs list Snowflake, BigQuery, Databricks, Redshift and Postgres, with Postgres supported on dbt v1 only.

Ready to try AI for Database?

Query your database in plain English. No SQL required. Start free today.