Skip to content

fix(ingest/mode): link chartless queries to reports and gate charts on report chart_count - #19382

Open
Ynabokov wants to merge 3 commits into
datahub-project:masterfrom
Ynabokov:fix/mode-chartless-query-report-link
Open

fix(ingest/mode): link chartless queries to reports and gate charts on report chart_count#19382
Ynabokov wants to merge 3 commits into
datahub-project:masterfrom
Ynabokov:fix/mode-chartless-query-report-link

Conversation

@Ynabokov

@Ynabokov Ynabokov commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Fixes Mode report↔query lineage broken by #17357.

PR #17357 gated the per-query chart fetch on query.get("chart_count"). Per the Mode API, chart_count is a report-level field - the query object does not expose it (the Report object (https://mode.com/developer/api-reference/analytics/reports/) has chart_count; the Query object (https://mode.com/developer/api-reference/analytics/queries/) has only explorations_count and report_imports_count). So in production the gate was always 0, _get_charts was never called, and reports received no chart/query lineage. #17357 passed CI only because its fixture added chart_count to the query object, which doesn't exist in the real API.

Changes

  • Gate the chart API call on the report's chart_count
  • Link chartless queries directly to the report via DashboardInfo.datasetEdges (a query otherwise reaches the report only through its charts, so chartless queries were orphaned). datasetEdges is used because DashboardInfo.datasets is deprecated.
  • Remove the bogus query-level chart_count custom property (queries don't have it).
  • Unit tests for the report-level gate (incl. missing / non-numeric chart_count coercion) and chartless → datasetEdges linking; integration fixture + golden updated to drop the non-existent query chart_count.

@github-actions github-actions Bot added ingestion PR or Issue related to the ingestion of metadata community-contribution PR or Issue raised by member(s) of DataHub Community labels Aug 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Linear: ING-3361

Thanks for your contribution! We have created an internal ticket to track this PR. A member of the core DataHub team will be assigned to review it within the next few business days - you will get a follow-up comment once a reviewer is assigned.

@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 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


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

<violation number="1" location="metadata-ingestion/src/datahub/ingestion/source/mode.py:2007">
P2: Chart fetching is gated entirely on the report-level chart_count. If report_chart_count coerces to 0 while the report does contain query charts (missing key, non-numeric, or a stale/under-counted value), all chart metadata and the report→chart→query lineage for that report are dropped, and every query is mislabeled chartless with a direct datasetEdge. Consider treating chart_count as an optimization hint rather than authoritative, or verifying against the fetched query data.</violation>
</file>

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

Re-trigger cubic

Comment thread metadata-ingestion/src/datahub/ingestion/source/mode.py
Comment thread metadata-ingestion/src/datahub/ingestion/source/mode.py
Comment thread metadata-ingestion/src/datahub/ingestion/source/mode.py
@maggiehays maggiehays added the needs-review Label for PRs that need review from a maintainer. label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution PR or Issue raised by member(s) of DataHub Community ingestion PR or Issue related to the ingestion of metadata needs-review Label for PRs that need review from a maintainer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants