Skip to content

fix(ingest/tableau): stop overwriting schema and browse paths of upstream tables - #21802

Open
aviraj-gour wants to merge 3 commits into
masterfrom
fix/tableau-skip-upstream-table-aspects
Open

aviraj-gour wants to merge 3 commits into
masterfrom
fix/tableau-skip-upstream-table-aspects

Conversation

@aviraj-gour

@aviraj-gour aviraj-gour commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Tableau source wrote a full schemaMetadata and a legacy browsePaths aspect onto every upstream warehouse table that Tableau's Metadata API reports as isEmbedded = true, even with ingest_tables_external: false. isEmbedded only describes how Tableau tracks the table, not who owns it. On sites without Tableau Data Management almost every table is embedded, so the flag skipped almost nothing.

Both aspects are full upserts, so they replaced what the warehouse connector had ingested:

  • schemaMetadata became platform: tableau, schemaName: "test", with Tableau's column casing (UPPERCASE for Snowflake) plus NullType duplicates from parsed custom SQL. Column-level lineage from SQL parsing and other connectors points at the warehouse's lowercase field paths, so it stopped rendering in the UI. The overwrite also caused schema-change notifications on every run.
  • browsePathsV2 moved the warehouse table under a Tableau project/datasource in Browse.

ingest_tables_external now gates emission of all upstream tables:

 emit_upstream_tables
+  if not ingest_tables_external
+    return
   for table in tableau databaseTables
-    if not table.isEmbedded and not ingest_tables_external
-      skip
     emit_table(schemaMetadata, browsePaths)
-  if ingest_tables_external
-    emit remaining SQL-parsed tables
+  emit remaining SQL-parsed tables

Tableau datasources still list these tables as upstreams. With the flag off, column-level lineage to Snowflake tables already matches against the schema the Snowflake connector ingested (_match_snowflake_column_name), which now stays intact.

Evidence

test_upstream_tables_are_emitted_only_when_enabled is now parametrized over embedded and external tables:

  • Before: is_embedded=True fails: with the flag off, emit_upstream_tables() still yields a workunit.
    After: both cases pass.
  • Tableau unit and integration tests: 478 passed, 4 xfailed. Integration goldens are unchanged because those recipes set ingest_tables_external: true.

Merge Danger

Door: two-way

Reverting restores the old emission. Overwritten schemas are restored by the next run of the warehouse connector.

Blast Radius: default-config Tableau recipes

  • With stateful ingestion enabled, the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector. They come back on that connector's next run. Documented in docs/how/breaking-changes.md.
  • Upstream tables no other connector ingests, such as CSV or Excel files (platform external), are no longer created and drop out of the lineage graph. Set ingest_tables_external: true to keep them.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes

🤖 Generated with Claude Code


Summary by cubic

Fixes the Tableau source overwriting the schema and browse paths of upstream warehouse tables, which broke their column-level lineage in the UI.

Previously, with ingest_tables_external: false (the default), Tableau still emitted full schemaMetadata and browsePaths aspects for every upstream table it tracks as embedded, replacing what the warehouse's own connector had ingested. isEmbedded only describes how Tableau tracks a table, not who owns it, so the flag skipped almost nothing.

ingest_tables_external now gates emission of all upstream tables. Tableau datasources still record those tables as upstreams.

Migration

  • With stateful ingestion enabled, the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector; run that connector to restore them. This happens once, since later Tableau runs no longer track those tables.
  • Upstream tables no other connector ingests, such as CSV or Excel files, are no longer created and drop out of the lineage graph. Set ingest_tables_external: true to keep them.

Written for commit 4bc44a4. Summary will update on new commits.

View guided diff Turn on auto-fix

@github-actions github-actions Bot added ingestion PR or Issue related to the ingestion of metadata docs Issues and Improvements to docs labels Dec 2, 2026
@aviraj-gour
aviraj-gour force-pushed the fix/tableau-skip-upstream-table-aspects branch from 49a6f87 to 09e537d Compare December 2, 2026 06:14
@codecov

codecov Bot commented Dec 2, 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 2, 2026 •

Copy link
Copy Markdown

Connector Tests Results

All connector tests passed for commit 4bc44a4

View full test logs →

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

Autogenerated by the connector-tests CI pipeline.

@aviraj-gour
aviraj-gour marked this pull request as ready for review December 2, 2026 06:53
@cursor

cursor Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
With the default ingest_tables_external: false, the Tableau source no longer emits upstream warehouse tables as dataset entities (no schemaMetadata / browse paths). Lineage still references them on data sources; only entity ingestion is gated.

Previously, only non-embedded upstreams were skipped when the flag was off, so embedded tables were still emitted and overwrote schema and browse metadata from warehouse connectors—breaking column-level lineage and UI browse.

emit_upstream_tables now returns immediately when the flag is false, instead of filtering on isEmbedded. Set ingest_tables_external: true for file-only upstreams (CSV/Excel) or when no warehouse plugin ingests those tables.

Docs add a breaking-changes entry (stateful first-run soft-deletes, re-run warehouse connectors) and an Upstream Tables note in the Tableau source guide. The unit test is parametrized so embedded and external tables both stay un-emitted when the flag is off.

Reviewed by Cursor Bugbot for commit 65ea642. 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 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. 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="docs/how/breaking-changes.md">

<violation number="1" location="docs/how/breaking-changes.md:24">
P2: The stateful-ingestion explanation uses the wrong denominator and omits the stale-removal guard. Describe the threshold as the percentage of entities from the previous checkpoint missing from the current run, and qualify soft-deletion with `remove_stale_metadata: true` (the default).</violation>
</file>

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

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

Comment thread docs/how/breaking-changes.md Outdated

**Before:** Tableau skipped only upstream tables it reports as external (`isEmbedded: false`) and emitted every other one, replacing the schema and browse paths that the warehouse's own connector had ingested.

**Now:** Tableau emits no upstream tables. Data sources still record them as upstreams, but a table that no other connector ingests, such as a CSV or Excel file (platform `external`), no longer exists as an entity and is not shown in the lineage graph. With stateful ingestion enabled, the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector; they reappear once that connector runs again. If those tables are more than `stateful_ingestion.fail_safe_threshold` (default 75) percent of the run's entities, the run fails with "Entity difference exceeds fail_safe_threshold" and keeps failing until the threshold is raised.

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: The stateful-ingestion explanation uses the wrong denominator and omits the stale-removal guard. Describe the threshold as the percentage of entities from the previous checkpoint missing from the current run, and qualify soft-deletion with remove_stale_metadata: true (the default).

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 docs/how/breaking-changes.md, line 24:

<comment>The stateful-ingestion explanation uses the wrong denominator and omits the stale-removal guard. Describe the threshold as the percentage of entities from the previous checkpoint missing from the current run, and qualify soft-deletion with `remove_stale_metadata: true` (the default).</comment>

<file context>
@@ -15,6 +15,16 @@ the one you are on and the one you are moving to, not just the target.
+
+**Before:** Tableau skipped only upstream tables it reports as external (`isEmbedded: false`) and emitted every other one, replacing the schema and browse paths that the warehouse's own connector had ingested.
+
+**Now:** Tableau emits no upstream tables. Data sources still record them as upstreams, but a table that no other connector ingests, such as a CSV or Excel file (platform `external`), no longer exists as an entity and is not shown in the lineage graph. With stateful ingestion enabled, the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector; they reappear once that connector runs again. If those tables are more than `stateful_ingestion.fail_safe_threshold` (default 75) percent of the run's entities, the run fails with "Entity difference exceeds fail_safe_threshold" and keeps failing until the threshold is raised.
+
+**Action:** with stateful ingestion enabled, run each warehouse connector after the first Tableau run following the upgrade. If that run hits the fail-safe, raise `fail_safe_threshold` for one run. To keep emitting upstream tables from Tableau, including file tables, set `ingest_tables_external: true`.
</file context>
Suggested change
**Now:** Tableau emits no upstream tables. Data sources still record them as upstreams, but a table that no other connector ingests, such as a CSV or Excel file (platform `external`), no longer exists as an entity and is not shown in the lineage graph. With stateful ingestion enabled, the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector; they reappear once that connector runs again. If those tables are more than `stateful_ingestion.fail_safe_threshold` (default 75) percent of the run's entities, the run fails with "Entity difference exceeds fail_safe_threshold" and keeps failing until the threshold is raised.
**Now:** Tableau emits no upstream tables. Data sources still record them as upstreams, but a table that no other connector ingests, such as a CSV or Excel file (platform `external`), no longer exists as an entity and is not shown in the lineage graph. With stateful ingestion and stale-entity removal enabled (the default), the first Tableau run after upgrading soft-deletes the tables it used to emit, including warehouse tables owned by another connector; they reappear once that connector runs again. If the percentage of entities from the previous checkpoint that are missing from the current run exceeds `stateful_ingestion.fail_safe_threshold` (default 75), the run fails with "Entity difference exceeds fail_safe_threshold" and keeps the previous state until the threshold is raised.

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.

Fixed in 65ea642. Soft-deletion is now qualified with stale-entity removal being enabled (the default). The fail-safe sentence is removed instead of corrected: upstream tables are a minority of a Tableau checkpoint (about 25–35% in the integration goldens), so the threshold is not reached and the run proceeds with a one-time soft-delete, which the entry now describes.

@naeemdh

naeemdh commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

The fix looks right to me: isEmbedded describes how Tableau tracks a table, not who owns it, so gating on it skipped almost nothing. Returning early also skips the databaseTables query when the flag is off, and Tableau no longer writes Status(removed=false) on warehouse tables, so it can't bring back tables their own connector soft-deleted.

Main ask: avoid the one-time soft-delete instead of documenting it

With stateful ingestion on, the first run after upgrading soft-deletes every warehouse table Tableau used to emit. They vanish from search and lineage until the warehouse connector runs again, and a table that connector filters out stays deleted. StaleEntityRemovalHandler.add_urn_to_skip() exists for this case (sources that used to checkpoint other sources' entities, dbt first). When ingest_tables_external is off, calling it for every URN in self.database_tables would remove the soft-delete for the normal upgrade, and the breaking-changes entry could drop the "run each warehouse connector afterwards" step.

Smaller points

  • Every integration recipe sets ingest_tables_external: true, so the new default (no table entities, upstreams still on datasources) is covered only by the unit test. A golden run with the flag off would guard it.
  • ingest_tables_external now means "emit upstream tables" whether or not they're external. The new description covers it; a rename with a deprecated alias could be a follow-up.
  • File tables (platform external) dropping out of lineage by default is probably the change users will notice most, so it may be worth leading with in the release note.

…ream tables

Tableau emitted schemaMetadata and browsePaths on every upstream table it
reported as embedded, even with ingest_tables_external disabled. isEmbedded
only says how Tableau tracks the table, not who owns it, so warehouse tables
ingested by their own connector had their schema and browse paths replaced,
hiding their column-level lineage in the UI.

ingest_tables_external now gates emission of all upstream tables.
…stream tables

Move the breaking-changes entry to the Next section with the PR number,
and warn that the first stateful run can exceed fail_safe_threshold.
Add an Upstream Tables note to tableau_pre.md and rewrite the
ingest_tables_external description to say it controls whether upstream
tables exist as entities.

This branch was successfully deployed

1 active deployment
Preview — 4bc44a45 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