Skip to content

fix(glue): stop a custom databaseName dropping every schema - #31958

Merged
mohittilala merged 9 commits into
mainfrom
fix/11571-glue-databasename-empty-ingestion
Aug 26, 2026
Merged

mohittilala merged 9 commits into
mainfrom
fix/11571-glue-databasename-empty-ingestion

Conversation

@mohittilala

@mohittilala mohittilala commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes open-metadata/openmetadata-collate#5942

Summary

Setting the Glue databaseName produced a successful ingestion with zero schemas and zero tables.

get_database_names yields the configured databaseName verbatim, and get_database_schema_names then filtered with schema.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

databaseName is 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.json description for the field. It claimed the default is default, while the code uses the Glue Catalog ID and yaml.mdx already 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 passed
  • pytest -c ingestion/pyproject.toml ingestion/tests/unit/topology/database/ -q, 1217 passed
  • basedpyright on the changed source, 0 errors and 0 warnings, no new entries against the violation baseline
  • ruff check and ruff format --check on the changed files

Reproduced first by driving the real get_database_names into get_database_schema_names sequence against the connector's own fixtures:

before   [databaseName unset]    databases=['118146679784']  schemas=['default','mydatabase','testdatalake_db','zipcode-db']
before   [databaseName=NEW_DB]   databases=['NEW_DB']        schemas=[]                 failures=0  warnings=0
after    [databaseName=NEW_DB]   databases=['NEW_DB']        schemas=['default','mydatabase','testdatalake_db','zipcode-db']

Tests

Two regression tests, both of which fail on main:

  • a configured databaseName still discovers every schema, with no failures and no warnings
  • schemas from two catalogs are merged under the one name and the run records a warning

The existing test_database_schema_names_filters_other_catalogs_before_schema_filter from #26908 still passes, so the default path keeps its catalog scoping.

Follow-ups, deliberately not in this PR

  • databaseFilterPattern is not applied to a custom databaseName today. Making it apply would be consistent with other connectors but is a behaviour change beyond this fix.
  • Glue has no catalogId connection field, unlike Athena. That is the proper way to express "ingest this specific catalog" and is a feature rather than a bug fix.
  • docs-om connectors/database/glue/yaml.mdx ships databaseName: database_name in 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 databaseName while preserving catalog identity for table and Iceberg-detail requests.

  • Treats a custom database name as an OpenMetadata label instead of a Glue catalog selector.
  • Records each discovered schema’s Catalog ID and supplies it to get_tables and Iceberg get_table requests.
  • Warns when multiple catalogs are merged and updates the schema-derived UI documentation.
  • Adds regression coverage for custom names, multiple catalogs, missing Catalog IDs, table discovery, and Iceberg columns.

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

Filename Overview
ingestion/src/metadata/ingestion/source/database/glue/metadata.py Correctly distinguishes custom database labels from catalog IDs and propagates each uniquely named schema’s catalog identity into table and Iceberg-detail requests.
ingestion/tests/unit/topology/database/test_glue.py Adds focused regression tests covering schema discovery, multi-catalog warnings, missing Catalog IDs, table pagination, and Iceberg detail lookup.
openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/glueConnection.json Corrects the databaseName description at the schema source of truth.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/connections/database/glueConnection.ts Regenerates the Glue connection documentation from the updated schema contract.
openmetadata-ui/src/main/resources/ui/src/generated/api/services/createDatabaseService.ts Regenerates the aggregated connection documentation to include the corrected Glue databaseName semantics.

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]
Loading

Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Context used (4)

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.
@mohittilala mohittilala self-assigned this Aug 24, 2026
@mohittilala
mohittilala requested a review from a team as a code owner August 24, 2026 11:33
Copilot AI lite review requested due to automatic review settings August 24, 2026 11:33
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Aug 24, 2026

Copilot AI 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.

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 databaseName is not configured.
  • Added regression tests covering custom databaseName schema discovery and multi-catalog warning behavior.
  • Updated the Glue connection JSON schema tooltip/description to correctly explain databaseName semantics 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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ TypeScript Types Auto-Updated

The generated TypeScript types have been automatically updated based on JSON schema changes in this PR.

Copilot AI review requested due to automatic review settings August 24, 2026 11:40

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 15 changed files in this pull request and generated 1 comment.

_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.
Copilot AI review requested due to automatic review settings August 24, 2026 12:21

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 15 changed files in this pull request and generated 1 comment.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.13% (80613/120074) 51.54% (49294/95630) 52.52% (14749/28082)

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 895cfe61ec0a2311735f722d25ba0d7e8fed37f9 in Playwright run 32963960490, attempt 1.

✅ 672 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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:

  • Common shard skew was 19.76% (convergence target: at most 15%).
  • Browser traffic was 221.12 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.66 per UI scenario (1870 boots / 702 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 162 0 0 0 0 0
✅ Shard chromium-02 133 0 0 0 0 0
✅ Shard chromium-03 156 0 0 0 0 0
✅ Shard chromium-04 157 0 0 0 0 0
✅ Shard ingestion-01 37 0 0 0 0 0
✅ Shard ingestion-02 27 0 0 0 0 0

📦 Download artifacts

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.
Copilot AI review requested due to automatic review settings August 24, 2026 20:30
@mohittilala mohittilala added the skip-pr-checks Bypass PR metadata validation check label Aug 24, 2026

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 15 changed files in this pull request and generated no new comments.

…sename-empty-ingestion

# Conflicts:
#	ingestion/tests/unit/topology/database/test_glue.py
Copilot AI review requested due to automatic review settings August 26, 2026 11:33
@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes 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.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Copilot AI 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.

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_map is keyed only by schema.Name. Because the databaseSchema node runs with threads=True, the topology runner materializes the full get_database_schema_names() output before processing schemas. If Glue returns the same schema name from multiple CatalogIds, the later entry overwrites the earlier catalog ID, and downstream get_tables/get_table calls for the earlier schema will use the wrong CatalogId (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)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@mohittilala
mohittilala enabled auto-merge August 26, 2026 14:05
@mohittilala
mohittilala added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 311b17d Aug 26, 2026
136 checks passed
@mohittilala
mohittilala deleted the fix/11571-glue-databasename-empty-ingestion branch August 26, 2026 20:55
mohittilala added a commit that referenced this pull request Sep 1, 2026
…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>
mohittilala added a commit that referenced this pull request Sep 1, 2026
…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>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants