Skip to content

Fixes #16038: Stop Tableau ingestion instead of deleting data models during a Metadata API backfill - #36007

Merged
harshsoni2024 merged 3 commits into
mainfrom
fix-16038-tableau-backfill-running
Oct 23, 2026
Merged

harshsoni2024 merged 3 commits into
mainfrom
fix-16038-tableau-backfill-running

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #16038

While Tableau rebuilds the store behind its Metadata API (after the API is enabled and after upgrades, for up to a week), every GraphQL response carries a BACKFILL_RUNNING warning next to data that may be missing whole workbooks. The connector never read errors, and it reads data models only from that API. A workbook the store had not reached yet therefore lost its data models: the run soft-deleted them under markDeletedDataModels, re-sent the dashboard without them (which unlinks them on the server), and reported success.

A run that reconciles data models now stops when Tableau reports the backfill, deletes nothing, and fails with a message to re-run after the backfill or to turn off markDeletedDataModels. With that off, it ingests the partial results and warns; the issue asks for the error only when deletion is on. Reproduced on main end to end against a live server (see Manual testing).

Type of change:

  • Bug fix

High-level design:

  • One read point for Metadata API warnings. Both GraphQL calls (_query_datasources and cache_custom_sql_tables) go through TableauClient._query_metadata_api. It sets metadata_api_backfill_running when any errors[].extensions.code is BACKFILL_RUNNING, logs it once, and returns the data unchanged. tableauserverclient only raises on errors with abort_on_error=True. The test connection borrows the same client, so a backfill it sees carries into the run.
  • Why the run does not raise where the warning is read. TopologyRunnerMixin._run_node_producer records a producer's exception, and the root node's post_process (mark_{dashboards,datamodels,charts}_as_deleted) then runs anyway, against a listing cut short. get_dashboard also catches per-dashboard exceptions, which would skip a dashboard and then soft-delete it. The earlier attempt in Detect Tableau BACKFILL_RUNNING errors and abort ingestion when markDeletedDashboards is enabled #25032 raised inside _query_datasources' own except Exception, so it never stopped a run.
  • Gate: includeDataModels and markDeletedDataModels (TableauSource._stops_for_backfill). The issue asks to fail when markDeletedDashboards is on. However, workbooks and views come from the REST API and stay complete during a backfill, so markDeletedDashboards and markDeletedCharts cannot delete anything because of it. What a partial listing deletes is data models, under markDeletedDataModels. With data models off, none are reconciled, so there is nothing to protect.
  • Stop, not only skip deletion. DashboardUpdater replaces a dashboard's dataModels links with the ones sent, so a run that carried on would still unlink the data models the store has not reached. TableauSource.get_dashboard stops producing at the first dashboard read after the warning, including the one whose data sources revealed it. The dashboard and chart listings stop there too, so all three mark_*_as_deleted steps are skipped.
  • Fail whatever successThreshold is. Every record the run sent succeeded, so TableauSource._iter raises WorkflowFatalError once the topology is done. It also records a Tableau Metadata API failure, so the run summary shows the reason. IterStep.run re-raises it and execute() stores the pipeline as failed. This is REVIEW.md's "Failed or partial discovery never drives deletion".
  • The cost of the way out. With markDeletedDataModels off, a dashboard whose workbook the store has not reached is still sent without its data models, so it loses those links until a run after the backfill. The fatal message says so, and the integration test pins it. Keeping the stored links for such a dashboard is possible, but it is a further behavior change and is left for a follow-up.
  • Not changed: Tableau's per-query partial-result warnings (NODE_LIMIT_EXCEEDED, TIME_LIMIT_EXCEEDED) and failed data-source queries (the broad except in get_datasources) still turn into short listings. Unlike a backfill they can recur on every run for one large workbook, so stopping and failing would block that site for good; they need a guard of their own. Recorded in ADR:2026-10-22-tableau-runs-stop-without-deleting-while-the-metadata-api-backfills.
  • Rollout: no schema, config or migration change. With default settings, a Tableau run ingests nothing and fails while a backfill lasts.

Tests:

Use cases covered

  • A Metadata API response carrying BACKFILL_RUNNING (the payload from the issue) is recorded and its data still returned, from the data-source query and from the custom SQL query a run opens with.
  • A complete response, or an error without a code, is not a backfill.
  • Data model deletion on, backfill reported before the first workbook: nothing is ingested.
  • Data model deletion on, backfill first reported by the second workbook's data sources: only the first dashboard, its chart and its data model are ingested.
  • In both of those runs there is no deleteStale request, and the run raises WorkflowFatalError naming BACKFILL_RUNNING and markDeletedDataModels, with one Tableau Metadata API failure.
  • markDeletedDataModels off, or includeDataModels off: every dashboard and chart and the partial data models are ingested, dashboards and charts are still reconciled, and the run ends with one warning and no failure.
  • A complete store ingests and reconciles dashboards, charts and data models as before, with no warning.
  • End to end against a live server: after a complete run, a backfill run whose store has not reached a workbook fails, and leaves that workbook's data model live and linked to its dashboard. With deletion off, the run succeeds with the warning, the data model stays live, and its dashboard loses the link (the cost the fatal message states).

Unit tests

  • I added unit tests for the new/changed logic.
  • Added: ingestion/tests/unit/topology/dashboard/test_tableau_backfill.py (9 tests). It runs the real TableauClient and TableauSource through Source.run(), the workflow's entrypoint and the real topology runner, with only tableauserverclient (Pager, metadata.query) and the OpenMetadata client mocked.
  • Updated: test_tableau.py. Its stub client gains metadata_api_backfill_running=False, since get_dashboard now reads it.
  • Ran every unit test that covers a changed file (changed tests plus every test importing a changed module), with PYTHONPATH=src:
    test_connection.py 37, test_dashboard_owned_connection.py 5, test_tableau.py 53, test_tableau_backfill.py 9, test_tableau_client.py 13, test_tableau_metrics.py 16, test_tableau_redacted_upstream.py 9: 142 passed, 0 failed.
  • Coverage (pytest-cov): every changed executable line is covered, 39/39 (metadata.py 28/28, client.py 11/11). File totals are client.py 74% and metadata.py 71%; the rest is untouched lineage and column code.
  • On main, 8 of the 9 new tests fail; the complete-store control passes. Each guard was also checked to fail when swapped out in-process: the producer stop, each of the three skipped deletions, the fatal error, the includeDataModels part of the gate, matching only the BACKFILL_RUNNING code, and reading an error without extensions.
  • Static checks: ruff check, ruff format --check and scripts/check_ruff_suppressions.py --check are clean. basedpyright (--baselinemode=discard) reports the same findings on client.py and metadata.py as on main.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • I added/updated ingestion integration tests for connector changes.
  • I ran the integration tests covering my changed files locally (PR CI runs only unit tests; the merge queue runs tests/integration/).
  • Added: ingestion/tests/integration/tableau/test_backfill.py (2 tests). It uses the existing harness that fakes Tableau at the HTTP transport; FakeTableauSite gains optional data sources, a backfill flag and not-yet-indexed workbooks, and its defaults keep the existing responses. The real MetadataWorkflow writes to a live server, and the assertions read back the data model and the dashboard's links. Each run resets DashboardServiceSource's seen-entity sets, as a scheduled run's fresh process does: they are class attributes, so two runs in one process would share them.
  • Ran against a local 2.0.0-SNAPSHOT server: tests/integration/tableau/ 8 passed, tests/integration/tags/test_dashboard_stages.py 8 passed, 16 passed. On main, both new tests fail (DID NOT RAISE WorkflowFatalError; no warning).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

No Tableau site with a running backfill was available, since Tableau only runs one after the Metadata API is enabled or upgraded. The scenario was replayed with the issue's GraphQL payload through the integration harness above: tableauserverclient, the connector and the workflow ran unmodified against a local server.

  1. Ingested a two-workbook site (Sales, Ops), each with one data source. Both data models were ingested and linked to their dashboards.
  2. Re-ran with every Metadata API response carrying BACKFILL_RUNNING and the store missing Ops, with fresh source state as a scheduled run has.
    • On main: the run reported success with no warning. The Ops data model was soft-deleted on the server (deleted: true), and the Ops dashboard's dataModels became [].
    • On this branch: the run failed with WorkflowFatalError: Tableau's Metadata API is still building its store (BACKFILL_RUNNING), so its results may be incomplete. The run stopped there and marked nothing as deleted: with markDeletedDataModels on, it would soft-delete data models that still exist in Tableau. Re-run once the backfill completes. To ingest meanwhile, turn off markDeletedDataModels; dashboards then lose their links to the data models the store has not reached, until a run after the backfill. No deleteStale request was sent, and the data model stayed live and linked.
    • On this branch with markDeletedDataModels: false: the run succeeded with the warning Tableau's Metadata API is still building its store (BACKFILL_RUNNING), so data models, their links to dashboards and lineage ingested in this run may be incomplete. Re-run once the backfill completes. Dashboards and charts were reconciled and data models were not. The Ops data model stayed live, and the Ops dashboard lost its link to it, as the fatal message warns.
  • Not run: a live Tableau Cloud or Server site during an actual backfill.

UI screen recording:

Not applicable — ingestion-only change.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. Not applicable: no schema change.

  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). Not applicable: ingestion-only change.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    Pass 1 on 6911f5ee5ab: no 🔴. 🟡 the fatal message offered turning off markDeletedDataModels without saying that dashboards then lose their links to the data models the store has not reached: the message now says so, and the integration test pins it. 🟡 a chart assertion that could never fail: each fake workbook now has a view. 🟡 history narration in a test docstring, and "as Bug - Tableau Ingestion must throw an error when there are errors with code= BACKFILL_RUNNING #16038 asked" in the record: reworded. 🟡 per-query partial-result warnings and failed data-source reads still shorten listings: pre-existing and out of scope; the record now says why they need a guard of their own. Fixed in 11133678e60. Pass 2 on 11133678e60: no 🔴. 🟡 the test for an error without extensions checked only the flag, so reading extensions strictly, which empties the listing, still passed: fixed in 57c01b9cf78, a test-only change that the same mutant now fails. 🟡 an unknown read is still written as "no data models" (pass 1's last two findings again), and 🟡 the TableauPipeline connector reads the same Metadata API without a backfill check: both pre-existing and outside this diff, left for follow-ups; no issues filed yet.

  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This description is gone from git log after the squash-merge.
    Added ADR:2026-10-22-tableau-runs-stop-without-deleting-while-the-metadata-api-backfills.

  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issue was found.

Summary

The Tableau connector now detects BACKFILL_RUNNING and stops runs that reconcile data models before incomplete results can remove models or dashboard links.

  • Tableau runs stop before reconciling data models during a backfill.

Acknowledged by harshsoni2024:

  • Dashboard links can disappear when markDeletedDataModels is off; preserving them is intentionally deferred.
  • Per-query limits and failed data-source reads remain outside this fix because they need a separate guard.
  • The TableauPipeline connector's missing backfill check is pre-existing and deferred.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Metadata API response] --> B{BACKFILL_RUNNING?}
    B -- No --> C[Continue normally]
    B -- Yes --> D[Remember backfill for this run]
    D --> E{includeDataModels and markDeletedDataModels?}
    E -- Yes --> F[Stop before dashboard write stages]
    F --> G[Skip all three deletion steps]
    G --> H[Raise WorkflowFatalError]
    E -- No --> I[Ingest returned data and record warning]
Loading

Reviews (1) · Last reviewed commit: "test(tableau): assert the data survives ..." · Reviewed by Greptile

While Tableau rebuilds the store behind its Metadata API, every GraphQL
response carries a BACKFILL_RUNNING warning next to data that may be
missing whole workbooks. Data models are read only from that API, so a
workbook the store had not reached yet lost its data models: the run
soft-deleted them under markDeletedDataModels and re-sent the dashboard
without them, unlinking them on the server.

The client now reads that warning on every Metadata API response. When
the run reconciles data models, the source stops producing dashboards,
skips the markDeleted* steps and fails with WorkflowFatalError once the
topology is done, since the runner reconciles even after a producer
raises. Otherwise the partial results are ingested with a status warning.

Fixes #16038
The fatal message offered turning off markDeletedDataModels without
saying that dashboards then lose their links to the data models the
store has not reached. It now says so, the warning names the links too,
and the integration test pins the cost. Each fake workbook in the unit
tests gets a view, so the chart assertions can fail. The decision record
says why per-query partial results need a guard of their own, and no
longer overstates what #16038 asked.
Reading an error's extensions strictly would raise inside
_query_datasources, whose catch turns the workbook's data sources into an
empty listing, while every test still passed. The test now checks the
data sources come back.
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner October 22, 2026 18:15
@harshsoni2024
harshsoni2024 requested review from Khairajani and a balanced review from Copilot October 22, 2026 18:15
@harshsoni2024 harshsoni2024 added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 22, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Changing Tableau backfill reconciliation can preserve stale data models or, with deletion disabled, unlink dashboards from models omitted by partial results.

Tableau connector now stops instead of deleting data models while the Metadata API is still rebuilding its store (BACKFILL_RUNNING), and fails the run with a re-run message when markDeletedDataModels is on. No issues found.

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

@TeddyCr
TeddyCr removed the request for review from Khairajani October 23, 2026 15:01
@harshsoni2024
harshsoni2024 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit d637aa9 Oct 23, 2026
78 of 122 checks passed
@harshsoni2024
harshsoni2024 deleted the fix-16038-tableau-backfill-running branch October 23, 2026 16:00
harshsoni2024 added a commit that referenced this pull request Oct 24, 2026
…during a Metadata API backfill [Backport #36007 - 2.0] (#36067)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion 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.

Bug - Tableau Ingestion must throw an error when there are errors with code= BACKFILL_RUNNING

3 participants