Repository navigation
fix(glue): stop a custom databaseName dropping every schema - #31958
Conversation
databaseName labels the OpenMetadata database, it does not name a Glue catalog. Schema discovery compared it against the Glue Catalog ID, so a custom name matched nothing and every schema was skipped while the run still reported Success. Skip that comparison when databaseName is set, since one name means one database and every visible Glue database is one of its schemas. Warn when that merges schemas from more than one catalog, so same-named schemas colliding is visible rather than silent. Also correct the connection schema description, which claimed the default database name is "default" while the code uses the Glue Catalog ID.
❌ 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 |
There was a problem hiding this comment.
Pull request overview
Fixes Glue ingestion behavior when a custom databaseName is configured, ensuring schemas are not incorrectly dropped due to an invalid CatalogId comparison, and improving user-facing configuration guidance.
Changes:
- Adjusted Glue schema discovery to only enforce CatalogId scoping when
databaseNameis not configured. - Added regression tests covering custom
databaseNameschema discovery and multi-catalog warning behavior. - Updated the Glue connection JSON schema tooltip/description to correctly explain
databaseNamesemantics and defaults.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/glueConnection.json | Corrects databaseName description to match actual default (Glue Catalog ID) and clarifies it is a display name, not an ingestion selector. |
| ingestion/src/metadata/ingestion/source/database/glue/metadata.py | Fixes schema filtering logic for custom databaseName; adds a warning when multiple CatalogIds are merged under one OpenMetadata database name. |
| ingestion/tests/unit/topology/database/test_glue.py | Adds regression coverage for custom databaseName schema discovery and multi-catalog merge warning. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
_get_glue_tables called get_tables with DatabaseName only, so it read from the caller's default catalog. Now that a schema from another catalog can be yielded, its tables would come back empty or belong to a same-named database in the wrong catalog. Stash each schema's Catalog ID as it is yielded and pass it to get_tables. The default path is unaffected, since the database there already is the caller's Catalog ID.
✅ Playwright Results — workflow succeededValidated commit ✅ 672 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) 49m 16s ⏱️ Max setup 4m 24s · max shard execution 18m 8s · max shard-job elapsed before upload 21m 6s · reporting 6s 🌐 221.12 requests/attempt · 2.66 app boots/UI scenario · 19.76% 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 |
GlueSchema.CatalogId is Optional, and adding it unguarded put None in the set used for the merge warning. Sorting that set then raised TypeError outside the per-schema try/except, so one database without a Catalog ID aborted schema discovery for the whole service. Track only non-empty Catalog IDs, reusing the guard the catalog map already applies.
…sename-empty-ingestion # Conflicts: # ingestion/tests/unit/topology/database/test_glue.py
Code Review ✅ ApprovedFixes Glue database ingestion by treating a custom databaseName as an OpenMetadata label rather than a catalog selector, preventing all schemas from being dropped. No issues found. OptionsDisplay: 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 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (1)
ingestion/src/metadata/ingestion/source/database/glue/metadata.py:225
schema_catalog_id_mapis keyed only byschema.Name. Because thedatabaseSchemanode runs withthreads=True, the topology runner materializes the fullget_database_schema_names()output before processing schemas. If Glue returns the same schema name from multipleCatalogIds, the later entry overwrites the earlier catalog ID, and downstreamget_tables/get_tablecalls for the earlier schema will use the wrongCatalogId(effectively making the chosen catalog non-deterministic).
Consider making collisions deterministic by skipping subsequent schemas that reuse an existing name with a different CatalogId (you already warn about overwrite risk), and avoid overwriting description/catalog mappings for the skipped schema.
if schema.Description:
self.schema_description_map[schema.Name] = Markdown(schema.Description)
if schema.CatalogId:
self.schema_catalog_id_map[schema.Name] = schema.CatalogId
catalog_ids_seen.add(schema.CatalogId)
|
|
…32399) * fix(glue): stop a custom databaseName dropping every schema databaseName labels the OpenMetadata database, it does not name a Glue catalog. Schema discovery compared it against the Glue Catalog ID, so a custom name matched nothing and every schema was skipped while the run still reported Success. Skip that comparison when databaseName is set, since one name means one database and every visible Glue database is one of its schemas. Warn when that merges schemas from more than one catalog, so same-named schemas colliding is visible rather than silent. Also correct the connection schema description, which claimed the default database name is "default" while the code uses the Glue Catalog ID. * Update generated TypeScript types * fix(glue): read a schema's tables from its own catalog _get_glue_tables called get_tables with DatabaseName only, so it read from the caller's default catalog. Now that a schema from another catalog can be yielded, its tables would come back empty or belong to a same-named database in the wrong catalog. Stash each schema's Catalog ID as it is yielded and pass it to get_tables. The default path is unaffected, since the database there already is the caller's Catalog ID. * fix(glue): ignore a missing Catalog ID when counting catalogs GlueSchema.CatalogId is Optional, and adding it unguarded put None in the set used for the merge warning. Sorting that set then raised TypeError outside the per-schema try/except, so one database without a Catalog ID aborted schema discovery for the whole service. Track only non-empty Catalog IDs, reusing the guard the catalog map already applies. * test(glue): assert on the warning reason, not the dict repr Status.warnings holds {key: reason} dicts, so asserting against str() of the entry depended on dict formatting and never checked which database the warning was about. Index by the database name instead, so a warning keyed to the wrong entity fails. * fix(glue): read Iceberg column detail from the schema's own catalog get_columns fetched Iceberg table detail with DatabaseName only, so for a schema discovered in another catalog the lookup resolved in the caller's catalog and raised. The fallback below it then served the unfiltered storage-descriptor columns, bringing dropped Iceberg columns back as live ones with only a logged warning. Pass CatalogId the same way _get_glue_tables does. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…32400) * fix(glue): stop a custom databaseName dropping every schema databaseName labels the OpenMetadata database, it does not name a Glue catalog. Schema discovery compared it against the Glue Catalog ID, so a custom name matched nothing and every schema was skipped while the run still reported Success. Skip that comparison when databaseName is set, since one name means one database and every visible Glue database is one of its schemas. Warn when that merges schemas from more than one catalog, so same-named schemas colliding is visible rather than silent. Also correct the connection schema description, which claimed the default database name is "default" while the code uses the Glue Catalog ID. * Update generated TypeScript types * fix(glue): read a schema's tables from its own catalog _get_glue_tables called get_tables with DatabaseName only, so it read from the caller's default catalog. Now that a schema from another catalog can be yielded, its tables would come back empty or belong to a same-named database in the wrong catalog. Stash each schema's Catalog ID as it is yielded and pass it to get_tables. The default path is unaffected, since the database there already is the caller's Catalog ID. * fix(glue): ignore a missing Catalog ID when counting catalogs GlueSchema.CatalogId is Optional, and adding it unguarded put None in the set used for the merge warning. Sorting that set then raised TypeError outside the per-schema try/except, so one database without a Catalog ID aborted schema discovery for the whole service. Track only non-empty Catalog IDs, reusing the guard the catalog map already applies. * test(glue): assert on the warning reason, not the dict repr Status.warnings holds {key: reason} dicts, so asserting against str() of the entry depended on dict formatting and never checked which database the warning was about. Index by the database name instead, so a warning keyed to the wrong entity fails. * fix(glue): read Iceberg column detail from the schema's own catalog get_columns fetched Iceberg table detail with DatabaseName only, so for a schema discovered in another catalog the lookup resolved in the caller's catalog and raised. The fallback below it then served the unfiltered storage-descriptor columns, bringing dropped Iceberg columns back as live ones with only a logged warning. Pass CatalogId the same way _get_glue_tables does. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>



Fixes open-metadata/openmetadata-collate#5942
Summary
Setting the Glue
databaseNameproduced a successful ingestion with zero schemas and zero tables.get_database_namesyields the configureddatabaseNameverbatim, andget_database_schema_namesthen filtered withschema.CatalogId != database_name, comparing that label against the Glue Catalog ID (the AWS account ID). Unless the user happened to type their own account ID into the field, nothing matched, every schema was skipped, and the run still reported Success with no failures and no warnings.The comparison came from #26908, which is correct for the default path where the OpenMetadata database really is the Catalog ID. It was applied to the custom-name path too, where it can never hold.
What this changes
databaseNameis a label for the OpenMetadata database, not a selector for a Glue catalog, which is how the field behaves across connectors. So when it is set there is exactly one database and every visible Glue database is one of its schemas, and there is nothing to scope by Catalog ID. When it is unset nothing changes: the database is the Catalog ID and schemas from other catalogs still belong elsewhere.A previous attempt at this (#31820, closed unmerged) made the same call conditional, and review raised that it dropped catalog scoping altogether, so schemas with the same name in different catalogs could silently collide under one database. Rather than invent a scoping rule the field never promised, this reports the situation: if schemas from more than one Catalog ID actually land in the database, the run records a warning naming the catalogs and telling the user to clear the field to get one database per catalog.
Also corrects the
glueConnection.jsondescription for the field. It claimed the default isdefault, while the code uses the Glue Catalog ID andyaml.mdxalready says so. That description is the tooltip in the Add Service form, so the wrong version was the one users read.Validation
pytest -c ingestion/pyproject.toml ingestion/tests/unit/topology/database/test_glue.py -q, 11 passedpytest -c ingestion/pyproject.toml ingestion/tests/unit/topology/database/ -q, 1217 passedbasedpyrighton the changed source, 0 errors and 0 warnings, no new entries against the violation baselineruff checkandruff format --checkon the changed filesReproduced first by driving the real
get_database_namesintoget_database_schema_namessequence against the connector's own fixtures:Tests
Two regression tests, both of which fail on
main:databaseNamestill discovers every schema, with no failures and no warningsThe existing
test_database_schema_names_filters_other_catalogs_before_schema_filterfrom #26908 still passes, so the default path keeps its catalog scoping.Follow-ups, deliberately not in this PR
databaseFilterPatternis not applied to a customdatabaseNametoday. Making it apply would be consistent with other connectors but is a behaviour change beyond this fix.catalogIdconnection field, unlike Athena. That is the proper way to express "ingest this specific catalog" and is a feature rather than a bug fix.docs-omconnectors/database/glue/yaml.mdxshipsdatabaseName: database_namein its sample YAML, which used to be exactly the broken case. Harmless now, but the sample should say what the field does.Greptile Summary
The PR corrects Glue ingestion with a configured
databaseNamewhile preserving catalog identity for table and Iceberg-detail requests.get_tablesand Icebergget_tablerequests.Confidence Score: 5/5
The PR appears safe to merge because both previously reported catalog-identity failures are fixed and no blocking failure remains.
The current table pagination and Iceberg detail paths both pass the discovered schema’s Catalog ID for the previously reported uniquely named foreign-catalog cases, and the added tests exercise those corrected calls; no blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR C[Glue connection] --> N{Custom databaseName?} N -->|No| D[OpenMetadata database = Catalog ID] N -->|Yes| L[OpenMetadata database = configured label] D --> F[Keep schemas from matching catalog] L --> A[Keep all visible Glue databases as schemas] A --> W{Multiple Catalog IDs?} W -->|Yes| X[Record ingestion warning] W -->|No| S[Continue] F --> M[Record schema name to Catalog ID] X --> M S --> M M --> T[get_tables with schema CatalogId] T --> I[Iceberg get_table with same CatalogId]Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
Context used (4)