Skip to content

feat(ingest/dbt,cube): column-level lineage for metrics - #21768

Open
sgomezvillamor wants to merge 73 commits into
masterfrom
feat-dbt-cube-metric-column-lineage
Open

sgomezvillamor wants to merge 73 commits into
masterfrom
feat-dbt-cube-metric-column-lineage

Conversation

@sgomezvillamor

@sgomezvillamor sgomezvillamor commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What

dbt and Cube build metrics through the SDK Metric builder but only wrote dataset-level upstreams. They now also write metric column lineage (metricUpstreams.fieldUpstreams) to the logical-dataset columns each metric aggregates. The logical-to-physical column mapping is unchanged and stays on the logical dataset's upstreamLineage.

dbt

  • A create_metric: true measure's metric reads its own measure column.
  • A top-level metrics: entry reads the column of each measure it resolves, using the same per-model resolution as the dataset upstreams (_locate_measure). A ratio built over measures reads a column on each side, across semantic models where it spans them.
  • A metric built on other metrics (derived, or a ratio whose sides name metrics) also reads the measure columns dbt lists in its input_measures, which a compiled manifest fills with the measures of every metric it builds on. Its derivedFrom edges to those metrics are unchanged.

Cube

  • Each view-measure metric reads that member's column on its logical dataset, matching the agg(alias.member) expression.

Config-gated. Metric column lineage follows the connector's column-lineage option: dbt include_column_lineage, Cube include_lineage and include_column_lineage. When it is off, fieldUpstreams is left unset (upstream_fields=None) rather than written as [], the same way dataset upstreamLineage leaves fineGrainedLineages unset when the option is off. Because metricUpstreams is upserted as a whole aspect, both choices leave the server in the same state: column edges written by an earlier run are cleared. Dataset-level metric upstreams are not affected by the option. The Cube semantic-model warning no longer says include_column_lineage is ignored.

No dangling edges. Field paths come from the same field set that builds the logical schema (dbt: the annotated measures, with convert_column_urns_to_lowercase applied; Cube: the logical dataset's schema, built from the same members). A measure dbt declares that cannot be resolved is left out and counted in num_metric_upstream_fields_unresolved rather than warned about per metric; a ratio side that names another metric is a derivedFrom edge and is not counted. Every field edge in the regenerated goldens was checked against the emitted schemaMetadata.

Goldens

Only metricUpstreams.fieldUpstreams changed (empty list → schemaField edges); datasetUpstreams is unchanged. The multi-project glob and Cube goldens contain only those aspect changes, with no unrelated audit-stamp or lastObserved noise.

Docs

  • dbt and Cube connector docs describe the metric column lineage and the option that controls it.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes (not a breaking change)

🤖 Generated with Claude Code


Summary by cubic

dbt and Cube metrics now carry column-level lineage to the logical-dataset columns they aggregate, on top of the existing dataset-level upstreams.

Behavior

  • Each metric's fieldUpstreams is written only when column lineage is enabled (dbt: include_column_lineage; Cube: include_lineage and include_column_lineage). With it off, fieldUpstreams stays unset yet still clears column edges an earlier run wrote.
  • A dbt create_metric measure reads its own column; a top-level metric reads the columns of each measure it resolves, both sides of a ratio included, plus the input measures dbt expands a derived metric into. Fields follow the dbt column lowercase rule.
  • A Cube view-measure metric reads that member's column on its logical dataset; the field always exists since the logical schema is built from the same members.
  • A dbt declared measure that resolves to no column is left out and counted once in num_metric_upstream_fields_unresolved, so no edge points at a column the dataset does not carry.
  • dbt and Cube connector docs now describe metric column lineage, and the Cube semantic-model warning no longer claims include_column_lineage is ignored.

Written for commit 131f03d. Summary will update on new commits.

View guided diff Turn on auto-fix

sgomezvillamor and others added 10 commits December 1, 2026 18:28
…property helpers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…semantic models

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Metrics now point at the measure columns they aggregate on their semantic
model datasets (metricUpstreams.fieldUpstreams), on top of the existing
dataset-level upstreams.

- A create_metric measure reads its own column.
- A top-level metric reads the column of each measure it resolves,
  including both sides of a ratio built over measures.
- A declared measure that resolves to no annotated measure column is left
  out and counted in num_metric_upstream_fields_unresolved, so no edge
  points at a column the dataset does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each metric emitted for a view measure now points at that measure's column
on its logical dataset (metricUpstreams.fieldUpstreams), the `alias.member`
its expression aggregates. A measure missing from the logical schema is
left out and counted in metric_upstream_fields_unresolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added ingestion PR or Issue related to the ingestion of metadata docs Issues and Improvements to docs labels Dec 1, 2026
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@datahub-connector-tests

datahub-connector-tests Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Connector Tests Results

Connector tests failed for commit 131f03d

View full test logs →

To skip connector tests, add the skip-connector-tests label (org members only).

Autogenerated by the connector-tests CI pipeline.

sgomezvillamor and others added 5 commits December 1, 2026 20:16
…h missing measure once

dbt fills a derived or ratio metric's input_measures with the measures of
the metrics it builds on, so those metrics do get column lineage to the
measure columns. Correct the docs and the unit test, which used a manifest
dbt never produces. Also visit each measure name once, so a measure listed
both in input_measures and as a ratio side is not counted twice when it
cannot be resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The logical dataset's schema is built from the same cube members the
metric loop walks, so a metric's member is always a field of it. Remove
the guard and the report counter that could never be non-zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lineage query's Metric fragment fails GraphQL validation on servers
older than v1.7.0. Send it through schema projection so the fragment is
dropped there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reuse the existing edge for a metric that stays, as the other edge
setters do, so a hydrated entity keeps its stamps and properties.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dataset URN passed to derived_from now raises InvalidUpstreamUrnError
with a hint to use upstream_datasets, and remove_derived_from matches
canonical URNs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sgomezvillamor and others added 2 commits December 1, 2026 20:58
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…at-dbt-cube-metric-column-lineage

# Conflicts:
#	docs/api/tutorials/semantic-models.md
sgomezvillamor and others added 5 commits December 2, 2026 10:45
- remove_upstream_metric no longer creates an empty upstreamMetrics
  snapshot when none is set, and drops duplicate edges
- browse_path accepts tuples and rejects a bare string
- field-level structured properties carry created/lastModified stamps
- Metric upstream_fields accepts a single field or a sequence
- Dashboard.remove_input_dataset uses the dataset-URN parser
- get_lineage declares the response fields it indexes as required
- clarify lineage docs and example comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dashboard.set_charts, Dashboard.set_dashboards, DataJob.set_inlets,
DataJob.set_outlets and DataJob.set_fine_grained_lineages appended to the
existing list. They now replace it, matching the SDK convention and
Dashboard.set_input_datasets: inputs are parsed before the aspect is touched,
duplicates are dropped keeping order, and dashboard edges for URNs that stay
keep their created/properties.

DataJob gains add_inlet, add_outlet, remove_inlet, remove_outlet and
add_fine_grained_lineage so callers have a way to add one item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep parent_container exactly as on master; only the new browse_path
accepts a bare string or tuple, normalized to a list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Popping while enumerating skipped the element after each removal, so an
adjacent duplicate could survive a remove_* call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dels

# Conflicts:
#	docs/how/breaking-changes.md
#	metadata-ingestion/src/datahub/sdk/metric.py
sgomezvillamor and others added 3 commits December 3, 2026 09:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent and related metrics

A Metric built to update metadata only (description, owners) used to write
empty metricRelationships and metricUpstreams, wiping the metric's lineage
in DataHub. Lineage arguments now follow the SDK convention: None leaves
DataHub's value alone, a list (including []) replaces it.

When metricRelationships is not set, the metric sends an empty generic
patch so the aspect still exists for hasParentMetric=false lookups,
without changing an existing one. A CREATE writes the default aspect.

Also adds parent_metric and related_metrics with set/add/remove methods.
Cube and dbt simple metrics pass derived_from=[] to keep clearing stale
metric-to-metric edges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mn-lineage

# Conflicts:
#	metadata-ingestion/src/datahub/ingestion/source/cube/cube_semantic_model.py
#	metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_semantic_model.py
sgomezvillamor and others added 2 commits December 3, 2026 10:57
- add_derived_from parses its input before creating metricRelationships, so
  a rejected input no longer leaves an empty aspect that wipes DataHub's.
- Move the metricRelationships no-op patch to an Entity._extra_mcps hook
  instead of widening Metric.as_mcps; as_workunits and the entity client
  send it.
- set_parent_metric raises SdkUsageError for a self-reference.
- Document that upstream_fields alone replaces the upstream datasets.
- Fix the lineage client stamp comment and the breaking-changes heading.
- Test rejected input, relationship setters on hydrated metrics, and
  remove_related_metric without an aspect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sgomezvillamor and others added 2 commits December 3, 2026 15:55
- metric_create example: use related_metrics instead of a reversed parent_metric.
- semantic_model_create example: emit as_workunits so the metricRelationships patch is included.
- breaking-changes: upstream_fields alone still replaces the upstream datasets.
- set_datasets: soft-delete hides the dataset from the whole catalog.
- Name _extra_mcps, not as_mcps, as the source of the relationships patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from feat-sdk-semanticmodels to master December 3, 2026 15:36
…c-column-lineage

# Conflicts:
#	metadata-ingestion/src/datahub/ingestion/source/cube/cube_semantic_model.py
#	metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_semantic_model.py
…c-column-lineage

# Conflicts:
#	metadata-ingestion/tests/unit/cube/test_cube_semantic_model.py
@sgomezvillamor
sgomezvillamor marked this pull request as ready for review December 3, 2026 17:56
@cursor

cursor Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
dbt and Cube semantic-layer ingestion now populate metricUpstreams.fieldUpstreams so each metric links to the logical-dataset columns it aggregates, not only dataset-level datasetUpstreams.

Cube (cube_semantic_model.py): view-measure metrics set upstream_fields to the matching member on the logical dataset when include_lineage and include_column_lineage are on; otherwise column edges are cleared on upsert. The semantic-model-mode warning clarifies that include_column_lineage applies only to metric→logical-dataset columns.

dbt (dbt_semantic_model.py): _MeasureLocation carries field_path; _column_lineage gates on include_column_lineage. create_metric measures and manifest metrics: entries resolve measure columns (including ratio sides and input_measures) via the existing _locate_measure index. Unresolvable declared measures are skipped and tracked on num_metric_upstream_fields_unresolved instead of emitting dangling schemaField URNs.

Connector docs and integration/unit tests plus golden metricUpstreams fixtures were updated for the new field edges.

Reviewed by Cursor Bugbot for commit 131f03d. Bugbot is set up for automated code reviews on this repo. Configure here.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_semantic_model.py">

<violation number="1" location="metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_semantic_model.py:1073">
P2: Derived metrics are given direct column lineage from their transitive `input_measures`. Restrict measure-column resolution to metric types that directly aggregate measures; derived metrics should retain only their `derivedFrom` edges.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

]
measure_names.extend(resolved.measure_names)
declared_folded = {name.casefold() for name in declared_measure_names}
measure_names = [*declared_measure_names, *resolved.measure_names]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Derived metrics are given direct column lineage from their transitive input_measures. Restrict measure-column resolution to metric types that directly aggregate measures; derived metrics should retain only their derivedFrom edges.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_semantic_model.py, line 1073:

<comment>Derived metrics are given direct column lineage from their transitive `input_measures`. Restrict measure-column resolution to metric types that directly aggregate measures; derived metrics should retain only their `derivedFrom` edges.</comment>

<file context>
@@ -1058,10 +1065,12 @@ def _metric_from_definition(
         ]
-        measure_names.extend(resolved.measure_names)
+        declared_folded = {name.casefold() for name in declared_measure_names}
+        measure_names = [*declared_measure_names, *resolved.measure_names]
         # A ratio's sides usually name other metrics, so they become derivedFrom
         # edges rather than measure references - but `_ratio_side` still renders
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changed: this is intentional. For a derived metric, a compiled dbt manifest lists in input_measures the measures of every metric it builds on, and those are the columns MetricFlow aggregates when it computes the metric, so the column edges describe what the metric reads. The derivedFrom edges to the metrics it builds on are kept as well. This is documented in dbt_post.md and covered by test_a_derived_metric_reads_the_columns_dbt_lists_as_its_input_measures. The human review raised the same question for the reviewer to decide, so I am leaving this thread open until that call is made.

@arniesaha

Copy link
Copy Markdown
Contributor

Automated first-pass review (ingestion review agent, at 8a00a1f; a human review follows)

Verdict: no blockers. 1 major, 2 minors; CI needs a rerun.

  • major cube/cube_semantic_model.py:385: the new Cube metric column lineage ignores include_column_lineage (and include_lineage), and the semantic-model warning in cube.py (~L290) still says metrics get no fine-grained lineage. Either gate upstream_fields on both flags, or call these edges structural in cube_post.md and fix the warning.
  • minor dbt/dbt_semantic_model.py ~L1101: no test covers a ratio side that names a metric, so the declared_folded guard keeping it out of num_metric_upstream_fields_unresolved is untested.
  • minor PR description: it says derived metrics read no column directly, but the code, dbt_post.md and test_a_derived_metric_reads_the_columns_dbt_lists_as_its_input_measures give them their input measures' columns. It also names a Cube counter that doesn't exist, and feat(sdk): metric column lineage, metric consumers and semantic-model metadata gaps #21764 has merged, so it's no longer stacked.

For the reviewer to decide: should derived metrics get direct column edges, or only derivedFrom? Should the "which column does this metric read" logic live in the SDK rather than in each connector?

CI: connector-tests fails with no failure in its log and isn't attributed to the PR; rerun it. Merges cleanly; goldens change only fieldUpstreams on 11 metrics.

… lineage

Metric fieldUpstreams are now written only when column lineage is enabled
(dbt: include_column_lineage; Cube: include_lineage and
include_column_lineage). When off, fieldUpstreams is left unset, as dataset
upstreamLineage leaves fineGrainedLineages unset; metricUpstreams is upserted
whole, so column edges from an earlier run are still cleared.

The Cube semantic-model warning no longer says include_column_lineage is
ignored, and tests cover the flag-off case for both connectors plus a dbt
ratio side that names a metric.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sgomezvillamor

Copy link
Copy Markdown
Contributor Author

Thanks for the first-pass review. Addressed in 131f03d:

  • major (column-lineage option): metric upstream_fields now follow the column-lineage option: dbt include_column_lineage, Cube include_lineage and include_column_lineage. When it is off, fieldUpstreams is left unset rather than written as [], the same way dataset upstreamLineage leaves fineGrainedLineages unset. metricUpstreams is upserted as a whole aspect, so edges from an earlier run are cleared either way. The Cube semantic-model warning is corrected, both connector docs mention the option, and tests cover the flag-off case for both connectors.
  • minor (ratio side naming a metric): added test_a_ratio_side_naming_a_metric_is_not_counted_as_unresolved, which covers the declared_folded guard.
  • minor (PR description): rewritten. It now says derived metrics read their input_measures columns, drops the Cube counter that does not exist and the stacked-PR note, and explains the config gating.

Still open for the reviewer: whether derived metrics should keep direct column edges or only derivedFrom. The code currently keeps both, and I replied in the matching cubic thread. Moving the "which column does this metric read" logic into the SDK is not part of this PR.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="metadata-ingestion/docs/sources/dbt/dbt_post.md">

<violation number="1" location="metadata-ingestion/docs/sources/dbt/dbt_post.md:638">
P3: The documentation says unresolved measures are always counted, but the mapper skips resolution and leaves the counter at zero when `include_column_lineage` is disabled. Qualify the counting behavior as applying when column lineage is enabled.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

- **One `semanticModel` per dbt project**, holding the join relationships between your semantic models. Its urn is `urn:li:semanticModel:(urn:li:dataPlatform:dbt,<project>,semantic_layer)`.
- **Semantic annotations on each semantic model's dataset.** The dataset keeps the urn, name, description, schema, subtype, tags, owners and lineage described above, and gains a link to its parent `semanticModel` plus a per-column annotation recording whether the column is a dimension or a measure, its aggregation function, and whether it is a time dimension.
- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, and `derivedFrom` edges to the metrics they are built on.
- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, column-level lineage to the measure columns they aggregate on those datasets (when `include_column_lineage` is enabled, the default), and `derivedFrom` edges to the metrics they are built on. A metric built on other metrics, such as a derived or ratio metric, also points at the measure columns of the metrics it builds on, as dbt lists them in the metric's input measures. A measure a metric names that cannot be matched to a measure column is left out of its column lineage and counted in the ingestion report.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The documentation says unresolved measures are always counted, but the mapper skips resolution and leaves the counter at zero when include_column_lineage is disabled. Qualify the counting behavior as applying when column lineage is enabled.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At metadata-ingestion/docs/sources/dbt/dbt_post.md, line 638:

<comment>The documentation says unresolved measures are always counted, but the mapper skips resolution and leaves the counter at zero when `include_column_lineage` is disabled. Qualify the counting behavior as applying when column lineage is enabled.</comment>

<file context>
@@ -635,7 +635,7 @@ On top of the datasets described above, DataHub can also describe your dbt seman
 - **One `semanticModel` per dbt project**, holding the join relationships between your semantic models. Its urn is `urn:li:semanticModel:(urn:li:dataPlatform:dbt,<project>,semantic_layer)`.
 - **Semantic annotations on each semantic model's dataset.** The dataset keeps the urn, name, description, schema, subtype, tags, owners and lineage described above, and gains a link to its parent `semanticModel` plus a per-column annotation recording whether the column is a dimension or a measure, its aggregation function, and whether it is a time dimension.
-- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, column-level lineage to the measure columns they aggregate on those datasets, and `derivedFrom` edges to the metrics they are built on. A metric built on other metrics, such as a derived or ratio metric, also points at the measure columns of the metrics it builds on, as dbt lists them in the metric's input measures. A measure a metric names that cannot be matched to a measure column is left out of its column lineage and counted in the ingestion report.
+- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, column-level lineage to the measure columns they aggregate on those datasets (when `include_column_lineage` is enabled, the default), and `derivedFrom` edges to the metrics they are built on. A metric built on other metrics, such as a derived or ratio metric, also points at the measure columns of the metrics it builds on, as dbt lists them in the metric's input measures. A measure a metric names that cannot be matched to a measure column is left out of its column lineage and counted in the ingestion report.
 
 Relationships follow MetricFlow's own join semantics: a semantic model that declares an entity as `foreign`, `unique` or `natural` joins to every semantic model that declares an entity of the **same name** as `primary`, `unique` or `natural`. When a key is declared in more than one semantic model, an edge is emitted to each - MetricFlow joins to each of them too. A reference to a key that is not in the ingested project is counted in the ingestion report rather than warned about, since that is normal when you filter part of a project.
</file context>
Suggested change
- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, column-level lineage to the measure columns they aggregate on those datasets (when `include_column_lineage` is enabled, the default), and `derivedFrom` edges to the metrics they are built on. A metric built on other metrics, such as a derived or ratio metric, also points at the measure columns of the metrics it builds on, as dbt lists them in the metric's input measures. A measure a metric names that cannot be matched to a measure column is left out of its column lineage and counted in the ingestion report.
- **One `metric` per measure with `create_metric: true`**, and one per top-level `metrics:` entry. Its urn is `urn:li:metric:(urn:li:dataPlatform:dbt,<project>,<metric_name>)`. Metrics carry an expression, a subtype naming dbt's metric type (`Simple`, `Ratio`, `Derived`, `Cumulative`, `Conversion`), upstream lineage to the datasets of the semantic models they read, column-level lineage to the measure columns they aggregate on those datasets (when `include_column_lineage` is enabled, the default), and `derivedFrom` edges to the metrics they are built on. A metric built on other metrics, such as a derived or ratio metric, also points at the measure columns of the metrics it builds on, as dbt lists them in the metric's input measures. When column lineage is enabled, a measure a metric names that cannot be matched to a measure column is left out of its column lineage and counted in the ingestion report.

This branch was successfully deployed

1 active deployment
Preview — 131f03d2 Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues and Improvements to docs ingestion PR or Issue related to the ingestion of metadata

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants