Repository navigation
Fixes #11571: Preserve custom Glue database names during ingestion - #31820
ayush-shah wants to merge 1 commit into
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| # A configured databaseName is an OpenMetadata display name, not a CatalogId. | ||
| if not self.service_connection.databaseName and schema.CatalogId != database_name: |
There was a problem hiding this comment.
If Glue returns databases from multiple CatalogIds, configuring databaseName disables the only CatalogId filter and emits every returned schema beneath one OpenMetadata database, causing unrelated schemas to be ingested together and same-named schemas to collide on one FQN.
Knowledge Base Used: Ingestion Framework
There was a problem hiding this comment.
Pull request overview
This PR fixes Glue schema discovery when a custom databaseName is configured by avoiding an incorrect comparison between the OpenMetadata display name and AWS Glue CatalogId, and adds a regression test to cover the custom-name path.
Changes:
- Adjust schema discovery filtering to skip the
CatalogId != database_namecheck whendatabaseNameis configured. - Add a unit test validating
get_database_schema_names()behavior with a custom database name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ingestion/src/metadata/ingestion/source/database/glue/metadata.py | Updates catalog filtering logic in schema discovery for the custom databaseName path. |
| ingestion/tests/unit/topology/database/test_glue.py | Adds regression coverage for schema discovery with a custom database name. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # A configured databaseName is an OpenMetadata display name, not a CatalogId. | ||
| if not self.service_connection.databaseName and schema.CatalogId != database_name: | ||
| continue |
| glue_source_new._get_glue_database_and_schemas = lambda: [ | ||
| DatabasePage( | ||
| DatabaseList=[ | ||
| GlueSchema( | ||
| CatalogId=MOCK_DATABASE.name.root, | ||
| Name="default", | ||
| Description="current catalog schema", | ||
| ) | ||
| ] | ||
| ) | ||
| ] |
| @@ -188,7 +188,8 @@ def get_database_schema_names(self) -> Iterable[str]: | |||
| for page in self._get_glue_database_and_schemas() or []: | |||
There was a problem hiding this comment.
💡 Edge Case: Custom databaseName skips all CatalogId scoping in schema discovery
With a custom databaseName configured, the guard now skips the schema.CatalogId != database_name check entirely, so every schema returned by the unscoped get_databases paginator is emitted under the single OpenMetadata database. In the common single-account case this is correct (all databases share one CatalogId), but if discovery ever returns databases from multiple catalogs (e.g. cross-account/shared resources), schemas with identical names from different catalogs would collide under one OM database. Consider scoping the query/filter to the account's own CatalogId even on the custom-name path to keep discovery deterministic. sources: ingestion/src/metadata/ingestion/source/database/glue/metadata.py:191-193
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsPreserves custom database display names during Glue schema discovery by making CatalogId filtering conditional. Consider retaining catalog scoping when custom database names are configured to prevent cross-catalog schema pollution. 💡 Edge Case: Custom databaseName skips all CatalogId scoping in schema discovery📄 ingestion/src/metadata/ingestion/source/database/glue/metadata.py:188-202 With a custom 🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 56m 45s ⏱️ Max setup 6m 49s · max shard execution 12m 50s · max shard-job elapsed before upload 21m 27s · reporting 3s 🌐 216.88 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|
Closing this PR per request. The investigation confirms the behavior is an unintended regression: CatalogId filtering was intentional for the default path, but it was incorrectly applied to the documented custom database-name path. No code from this PR was merged. |
Fixes #11571
Summary
A configured Glue
databaseNameis an OpenMetadata display name, not necessarily the AWS GlueCatalogId. After the catalog filtering change in #26908, schema discovery compared the display name directly withCatalogIdand silently skipped every schema when a custom name was configured.This change keeps catalog filtering for the default Catalog ID-based path and skips that comparison only for the documented custom-name path. It adds a regression test covering schema discovery with a custom database name.
Validation
pytest -c ingestion/pyproject.toml ingestion/tests/unit/topology/database/test_glue.py -q— 10 passedruff checkon the changed Python filesruff format --checkon the changed Python filesgit diff --checkGreptile Summary
The PR allows Glue schema discovery to proceed when the configured OpenMetadata database display name differs from AWS Glue's CatalogId and adds regression coverage for that path.
Confidence Score: 4/5
The PR should not merge until custom display names preserve AWS Glue catalog scoping when discovery returns databases from multiple catalogs.
The new truthiness check accepts every CatalogId returned by an unscoped get_databases paginator and emits those schemas beneath one display-named OpenMetadata database.
Files Needing Attention: ingestion/src/metadata/ingestion/source/database/glue/metadata.py
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Glue get_databases pages] --> B{databaseName configured?} B -->|No| C[Keep schemas matching current CatalogId] B -->|Yes| D[Accept schemas from every returned CatalogId] C --> E[Emit OpenMetadata schemas] D --> EReviews (1): Last reviewed commit: "Fix Glue custom database schema discover..." | Re-trigger Greptile
Context used: