Skip to content

Fixes #37978: MicroStrategy reads a report dataset's lineage from its source cube - #37979

Merged
Khairajani merged 4 commits into
mainfrom
mstr-cube-report-source
Nov 19, 2026
Merged

Khairajani merged 4 commits into
mainfrom
mstr-cube-report-source

Conversation

@Khairajani

@Khairajani Khairajani commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #37978

A dossier dataset can be a report rather than an Intelligent Cube. The SQL view refuses it ("Only cube is supported to get SQL view"), so it had no lineage.

  • A report built on an Intelligent Cube now gets the cube's lineage, tables and columns. GET /v2/reports/{id} names the cube in source: read-only, no modeling privilege. A report on a Data Import cube is matched on names, as the cube is.
  • Clearer warnings for what still has no lineage, because MicroStrategy writes the SQL only when it queries the warehouse:
    • a report on warehouse tables, called a prompted report when it has prompts;
    • a Live Intelligent Cube.
  • The rules are added to ADR:2026-11-05-microstrategy-charts-are-named-by-dossier-and-the-search-is-paged (v7).

Type of change:

  • Bug fix

Tests:

  • ingestion/tests/unit/topology/dashboard/test_microstrategy.py: report on a cube, report on a Data Import cube (column pairs), warehouse and prompted reports, unreadable report, Live cube. 110 pass; the new ones fail on main.
  • E2E against a MicroStrategy trial with BigQuery, on a dossier holding a cube report, a warehouse report and a Live cube:
    • main: the cube report gets no lineage, 0 failures.
    • this PR: the cube report gets 3 table edges and 4 column pairs; the warehouse report and the Live cube log the new warnings; 0 failures; other lineage unchanged.
  • Not covered E2E: a prompted report (unit test only).

Checklist:

  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests around the new logic.
  • For connector/ingestion changes: I updated the documentation.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge.

Summary

MicroStrategy report datasets now inherit lineage from their source Intelligent Cube, while keeping the cube’s identity alongside its cached SQL.

  • Reports built on Intelligent Cubes get lineage from the cube’s SQL.
  • Warnings explain why warehouse reports and Live cubes have no lineage.

The earlier finding about reused reports losing column links is addressed. No new actionable issues found.

Reviews (4) · Last reviewed commit: "MicroStrategy: cache a report's source c..." · Reviewed by Greptile

@Khairajani
Khairajani requested a review from a team as a code owner November 17, 2026 12:18
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 17, 2026
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

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.

else the dataset itself. Known right after the dataset's SQL was requested; the caller
keeps it, since the report cache may later evict it.
"""
return self._report_cubes.get(dataset_id) or dataset_id

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you also test eviction of both _report_cubes and _source_tables, keeping _cube_sql populated?

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.

Good catch, thanks! That case did lose the cube. The cube is now saved together with the SQL, so they can't get out of sync. I added a test where both caches are cleared and only the SQL is still cached. Fixed in 2abd985.

The report and parse caches could evict a report while the SQL cache still
held it, so the report was matched as a schema cube and lost its column pairs.
@gitar-bot

gitar-bot Bot commented Nov 19, 2026

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

Reading report lineage from its source cube changes catalog lineage for MicroStrategy datasets, so incorrect source identification could misattribute table and column dependencies.

Reports built on an Intelligent Cube now inherit the cube's table and column lineage, and warehouse reports and Live cubes get clearer warnings about missing lineage. The cache-eviction issue that could drop column links for reused reports has been addressed. No open issues found.

✅ 1 closed
✅ Edge Case: cube_behind reads an LRU cache that can be evicted while the parse is cached

📄 ingestion/src/metadata/ingestion/source/dashboard/microstrategy/client.py:337-342 📄 ingestion/src/metadata/ingestion/source/dashboard/microstrategy/metadata.py:482-485
cube_behind resolves a report to its source cube only by peeking at _report_cubes with .get. That peek doesn't refresh the entry's LRU position. The value it needs is also only there if get_cube_sql_details ran recently. In metadata.py, _parse_cube results are kept in the separate _source_tables cache, keyed on (dataset.id, dialect). When later dossiers share a report dataset, they hit that cache and never call get_report_cube again. Once more than CACHE_SIZE other reports have gone through _report_cubes, the report's entry is evicted. cube_behind(R1) then returns R1, and get_dataset_subtype reads the report's subtype (768) instead of the Data Import cube's (779/780). The dataset is then matched as a schema cube and loses its column pairs, while its table edges are still emitted.

Fix: carry the resolved cube id with the parsed result (e.g. a cube_id field on ParsedCube, filled by _parse_cube from the client), so the subtype lookup uses the same cached unit as the SQL and doesn't rely on a second cache.

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 545f1a1 into main Nov 19, 2026
56 of 59 checks passed
@Khairajani
Khairajani deleted the mstr-cube-report-source branch November 19, 2026 12:55
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.

MicroStrategy datasets that are reports built on an Intelligent Cube get no lineage

2 participants