Skip to content

[2.1] Fixes #38334: MicroStrategy column lineage for schema cube metrics - #38337

Merged
Khairajani merged 6 commits into
2.1from
mstr-metric-column-lineage-2.1
Nov 24, 2026
Merged

Khairajani merged 6 commits into
2.1from
mstr-metric-column-lineage-2.1

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38334

Backport of #38335 to 2.1. A clean cherry-pick: the connector code is identical to main. Metrics of schema-based MicroStrategy cubes get column-level lineage. A metric is linked through the SQL projection named after its column alias (or its name when none is set), or else through the metrics and facts its definition is built from. A projection is a metric's only when no other dataset object claims it. Metric column lineage needs Architect read.

Type of change:

  • Improvement

Tests:

Checklist:

  • My PR title is [2.1] Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests and listed them above.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The PR should not merge until unreadable metrics still block competing claims to their SQL projections.

Findings

  1. P1 Metrics get the wrong columns ▶

Summary

Adds column lineage for schema cube metrics through SQL aliases or the facts and metrics in their definitions.

  • Schema-cube metrics now link to the warehouse columns their SQL projections or definitions use.
  • Nested schema expressions now link all of their source columns.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Schema cube metric] --> B[Read metric definition]
  B --> C[Use column alias or metric name]
  C --> D{SQL has an unshared matching alias?}
  D -->|Yes| E[Link columns read by that projection]
  D -->|No| F[Follow referenced metrics and facts]
  F --> G[Match their columns against cube SQL]
  G --> H[Add supported column edges]
  E --> H
Loading

Reviews (9) · Last reviewed commit: "MicroStrategy: match a metric's SQL proj..." · Reviewed by Greptile

A metric is linked to the columns of the SQL projection named after it, else
through the metrics and facts its definition is built from.
@Khairajani
Khairajani requested a review from a team as a code owner November 20, 2026 20:05
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 20, 2026
@Khairajani
Khairajani requested review from akashverma0786 and removed request for a team November 20, 2026 20:05
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

…and load on Python 3.11

A metric the definition references now matches an alias only when no other object of the dataset shares its name, as the metric's own name already did. The ParsedCube alias default moves to a factory, since Python 3.11 refuses an unhashable dataclass default.
…ct owns that name

A metric a definition references, but the dataset does not hold, could take the alias of a dataset object whose name normalizes the same. Aliases are now matched by object id: an alias is a metric's only when no other object of the dataset has that name.
A metric can set a column alias that the SQL generator names its projection after in place of its name, so a display name can match another metric's projection. Each metric's alias now comes from its definition, every dataset object claims the name it is projected under before any metric is matched, and referenced metrics are matched on their own alias. Without modeling privileges the name stands in for the alias.
A metric whose definition fails to read dropped out of the alias claims, so another metric sharing its name could take its projection. It now claims its name, blocking that match without getting a column edge itself.
… be read

Without modeling privileges a metric's column alias is unknown, so matching its name could take a projection another metric's alias names. Metrics now get no column edge then; they still claim their names, so no other metric takes those projections.
@gitar-bot

gitar-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Adding schema-cube metric column lineage could associate metrics with incorrect warehouse columns when SQL aliases or definitions are ambiguous.

Adds column lineage for schema-based MicroStrategy cube metrics via their SQL projection aliases or the metrics and facts in their definitions. Changes are requested because the shared-alias guard does not account for referenced metrics missing from the dataset, so Revenue Share can be linked to the wrong columns when built from % Revenue, which is not in the cube.

✅ 1 closed
Closed: Edge Case: Shared-alias guard misses referenced metrics that aren't in the dataset

📄 ingestion/src/metadata/ingestion/source/dashboard/microstrategy/metadata.py:572-583 📄 ingestion/src/metadata/ingestion/source/dashboard/microstrategy/metadata.py:498-499
named() treats a name as ambiguous only when two objects in the dataset's availableObjects normalize to the same key (lines 498-499). A metric referenced in a definition but not added to the cube is never counted. Example: a dataset has Revenue (alias REVENUE) and Revenue Share, which is built from % Revenue, and % Revenue is not in the dataset. normalized('% Revenue') gives REVENUE, which is not in ambiguous, so named accepts it. get_metric_parts then stops at that metric, and Revenue's projection columns get attributed to Revenue Share instead of the columns of % Revenue's own facts. The new test only passes because % Margin happens to be in the dataset. Fix: accept a referenced metric's alias only if that metric is itself a dataset object with a unique key, for example by also checking its key against the dataset's object keys, or better, by matching on object id.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Khairajani
Khairajani merged commit 8ef5949 into 2.1 Nov 24, 2026
46 of 49 checks passed
@Khairajani
Khairajani deleted the mstr-metric-column-lineage-2.1 branch November 24, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant