fix(ingest/dataplex): preserve upstream platform in cross-platform lineage URNs#16771
Open
fix(ingest/dataplex): preserve upstream platform in cross-platform lineage URNs#16771
Conversation
…neage URNs When the GCP Data Lineage API reports a GCS file as upstream of a BigQuery external table, the Dataplex connector was generating the upstream URN with the target's platform (bigquery) instead of the source's platform (gcs). This created phantom entities that never matched GCS-ingested datasets. Root cause: _extract_entry_id_from_fqn() parsed the platform from the FQN (e.g. "gcs:bucket/path") but discarded it, and LineageEdge had no platform field. get_lineage_for_table() then fell back to the target's platform. Fix: add platform field to LineageEdge, extract it from the FQN during build_lineage_map(), and use it in get_lineage_for_table() when building the upstream URN. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Linear: ING-2062 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…o DataHub format The GCP Data Lineage API returns GCS FQNs as bucket.`path/*.csv` but DataHub's GCS source creates URNs with bucket/path (slash-separated, no backticks, no glob). Without normalization, the GCS upstream URNs from Dataplex lineage never resolve to real GCS-ingested entities. Add _normalize_gcs_entry_id() to transform the Data Lineage API format: strip backticks, replace bucket.path dot separator with slash, and remove trailing glob patterns (/*.csv, /*.parquet, etc.). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Your PR has been assigned to @maggiehays (maggie) for review (ING-2062). |
Contributor
|
I'm fully rewriting dataplex connector in #16723 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Dataplex lineage connector generating incorrect upstream URNs when the GCP Data Lineage API reports cross-platform relationships (e.g. GCS file -> BigQuery external table). Two issues fixed:
Wrong platform (commit 1):
get_lineage_for_table()used the target entry's platform for all upstream URNs, so a GCS upstream gotdataPlatform:bigqueryinstead ofdataPlatform:gcs. Fixed by addingplatformfield toLineageEdgeand preserving the upstream's platform from the FQN.Wrong entry ID format (commit 2): The GCP Data Lineage API returns GCS FQNs as
bucket.`path/*.csv`but DataHub's GCS source creates URNs withbucket/path(slash-separated, no backticks, no glob). Added_normalize_gcs_entry_id()to transform the format so upstream URNs resolve to real GCS-ingested entities.Changes
Commit 1: Platform fix
platformfield toLineageEdgedataclass_extract_entry_id_from_fqn()to_extract_platform_and_entry_id_from_fqn()returning(platform, entry_id)tuple (old name kept as backward-compatible wrapper)build_lineage_map()to extract and store the upstream platform from the FQNget_lineage_for_table()to uselineage_edge.platforminstead of the target's platform parameterCommit 2: GCS entry ID normalization
_normalize_gcs_entry_id()method: strips backticks, replaces dot bucket separator with slash, removes trailing glob patterns_extract_platform_and_entry_id_from_fqn()when platform isgcsTest plan
test_cross_platform_lineage_preserves_upstream_platform- verifies GCS upstream getsdataPlatform:gcsURN (commit 1)test_normalize_gcs_entry_id- unit tests for normalization edge cases: backtick+glob, no glob, no backticks, bucket only, already normalized (commit 2)test_gcs_entry_id_normalized_to_datahub_format- end-to-end test through full pipeline verifying URN name matches DataHub GCS source format (commit 2)🤖 Generated with Claude Code