Skip to content

[Detail Bug] External table lineage missing for GCS locations reported as gcs:// #37301

Closed

Description

@detail-app

Detail Bug Report

https://app.detail.dev/org_3377c26d-da48-4ccd-b83a-22c542f4fe83/bugs/bug_49af880b-5ee9-4be8-b6a5-aefd7f11c5d6

Introduced in #34634 by @harshsoni2024 on Oct 5, 2026

Summary

  • Context: ExternalTableLineageMixin is shared by the Snowflake, Glue, Redshift, Athena, Databricks and Unity Catalog database sources to link an external table to the storage Container holding its data, by resolving the table's reported location against the container index via an exact-match fullPath search.
  • Bug: The helper container_lookup_paths in ingestion/src/metadata/ingestion/source/database/external_table_lineage_mixin.py de-aliases only the Hadoop S3 schemes (s3a/s3n -> s3) before the exact-match lookup, but the GCS storage connector indexes every container under gs://, while catalog sources report GCS locations as gcs:// — so those lookups can never match.
  • Actual vs. expected: A GCS-backed external table whose location is reported as gcs://bucket/key emits no container-table lineage edge, even though the storage service was ingested and the container exists; the expected behavior (and the working behavior for every other scheme) is to de-alias gcs to gs and emit the edge.
  • Impact: Every external table backed by Google Cloud Storage (e.g. Snowflake external tables on GCS stages) silently loses both its table-level and column-level container lineage, and the only hint is a debug-level log message that misleadingly tells the user to "ingest the storage service" it already ingested.

Code with Bug

# ingestion/src/metadata/ingestion/source/database/external_table_lineage_mixin.py
_SCHEME_ALIASES = {"s3a": "s3", "s3n": "s3"}   # <-- BUG 🔴 missing gcs->gs alias

def container_lookup_paths(location: str | None) -> list[str]:
    ...
    if match := _SCHEME_PATTERN.match(location):
        scheme = match.group(1).lower()
        path = location[match.end() :]
        canonical = f"{_SCHEME_ALIASES.get(scheme, scheme)}://{path}"   # <-- BUG 🔴 canonical stays gcs:// so can't match gs:// containers
# ingestion/src/metadata/ingestion/source/storage/gcs/metadata.py
full_path = f"gs://{self._clean_path(bucket_name)}"   # <-- container index uses gs://

Explanation

The container lookup uses an exact match on fullPath (via es_search_container_by_path) and performs no server-side normalization. The GCS storage connector writes containers as gs://..., but some database sources (notably Snowflake) report external locations as gcs://.... Since container_lookup_paths does not translate gcs to gs, it only searches for gcs://... candidates, so the lookup never finds the existing container and the mixin silently skips emitting container→table (and downstream column) lineage.

Codebase Inconsistency

ingestion/src/metadata/ingestion/source/database/unitycatalog/path_utils.py already normalizes "gcs": "gs" (along with several other aliases) for the same es_search_container_by_path lookup, indicating the shared mixin is missing a required alias.

Recommended Fix

Add "gcs": "gs" to _SCHEME_ALIASES in ingestion/src/metadata/ingestion/source/database/external_table_lineage_mixin.py (and consider mirroring the alias set in unitycatalog/path_utils.py). Also apply equivalent de-aliasing in ingestion/src/metadata/ingestion/source/database/snowflake/lineage.py::_resolve_container_by_path, which currently does a single exact lookup on the raw COPY_HISTORY.stage_location.

History

This bug was introduced in commit 39279a9 (#34634, "fix(glue): match external table locations with a trailing slash to their containers", Harsh Soni, 2026-10-05). That change added container_lookup_paths and _SCHEME_ALIASES to normalize only s3a/s3n -> s3, omitting gcs -> gs.

Activity

  1. added a commit that references this issue on Nov 13, 2026
    1de7ad1
  2. added a commit that references this issue on Nov 19, 2026
    a113d06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Done ✅
  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions