Skip to content

Fixes 36348: Glue test connection probes only what ingestion reads - #36347

Merged
Khairajani merged 11 commits into
mainfrom
fix/glue-test-connection-schema-filter
Oct 29, 2026
Merged

Khairajani merged 11 commits into
mainfrom
fix/glue-test-connection-schema-filter

Conversation

@Khairajani

@Khairajani Khairajani commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36348

The Glue GetTables test-connection step ignored the connection's filter patterns and probed the first databases GetDatabases returned. A database the identity can't read — e.g. a cross-account resource link that sorts first — failed the step with AccessDeniedException, and the metadata agent with it, since GlueSource runs the check before its own schema filter applies.

The probe now applies the same filters ingestion does, while paging:

  • databaseFilterPattern on the catalog ID (skipped when databaseName is set, as in ingestion)
  • schemaFilterPattern on the Glue database name
  • tableFilterPattern on table names (first 128 characters, as ingestion stores them) — a database whose tables are all filtered out doesn't count, so the probe moves on

Which patterns: during an ingestion run, GlueSource scopes the check to the pipeline's filters (sourceConfig), matching fully qualified names when useFqnForFiltering is set — exactly what ingestion reads. The connection's default patterns are the fallback for a standalone Test Connection.

Excluded databases are never probed, and a targeted one past the 10-database cap is still reached. The scan is capped at 1000 databases and 1000 tables in total, so a selective filter can't outrun the step timeout; spending either cap without a kept table returns a non-blocking "Table probe stopped early" caveat. It also passes each database's CatalogId to GetTables, as ingestion does.

Decision record: ADR:2026-10-27-glue-test-connection-probes-what-ingestion-reads (pipeline-scoped filters, scan budgets).

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • Schema filter excludes a denied first database → probe skips it and passes on the targeted one
  • Database filter excludes a catalog whose database is denied → never probed
  • Table filter: only kept tables are counted; a database with every table filtered out is skipped
  • Filter set only on the pipeline (not the connection) → honored by the startup check, driven through GlueSource
  • useFqnForFiltering → schema and table patterns match fully qualified names
  • Targeted database sorts past the probe cap, or on a later page → still reached
  • Probe stops after the 10-database cap and the 1000-database / 1000-table scan budgets
  • A later GetDatabases page fails after an empty probe → the failure names glue:GetDatabases, not the previous database's GetTables
  • Filters exclude everything → non-blocking caveat naming the filter patterns
  • No filter, denied first database → still fails (unchanged)

Unit tests

  • ingestion/tests/unit/source/database/glue/test_connection.py (49 passed)

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable — covered by unit tests and the manual run below.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

metadata ingest against a real AWS Glue catalog via assumeRoleArn, with the role explicitly denied glue:GetTables on the first-listed database and schemaFilterPattern including only the target:

  • Before: GetTables: Failed – AccessDeniedException, workflow aborts.
  • After: test connection passes, 100% success, only the targeted database's tables ingested.

Then, on real Glue with all three filters set (database: the account's catalog ID, schema: ^e2e_, which excludes the denied database, table: excludes ^tmp_):

  • The probe never touched the denied database, skipped a database whose only table was filtered out, and passed on the next one; only the kept table was ingested.
  • With the database filter excluding the catalog instead, the probe made no GetTables call and returned the non-blocking "No tables visible" caveat.

The same scenarios also pass against a local Glue emulator, plus a run with the schema filter set only on the pipeline: before, GetTables failed with AccessDeniedException; after, it passed and only the target was ingested.

UI screen recording:

Not applicable — ingestion-only fix.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #36348 above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Decision check: adds docs/decisions/2026-10-27-glue-test-connection-probes-what-ingestion-reads.md.
  • I have added a test that covers the exact scenario we are fixing.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issue remains.

Summary

The Glue table check now uses the filters ingestion uses instead of probing excluded databases.

  • Glue’s startup table check probes the databases and tables ingestion keeps.

All seven supplied previous threads are unnumbered. Their requested fixes are present in the current code and tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Glue connection check] --> B{Pipeline run?}
  B -->|Yes| C[Use pipeline filters]
  B -->|No| D[Use connection filters]
  C --> E[Read database pages lazily]
  D --> E
  E --> F[Skip excluded databases]
  F --> G[Read and filter tables]
  G --> H{Kept table found?}
  H -->|Yes| I[Pass with table count]
  H -->|No, budget remains| E
  H -->|No, scan budget spent| J[Pass with stopped-early caveat]
Loading

Reviews (11) · Last reviewed commit: "Merge branch 'main' into fix/glue-test-c..." · Reviewed by Greptile

The probe ran GetTables on the first databases GetDatabases returned,
ignoring the connection's schemaFilterPattern. A database the identity
cannot read - e.g. a cross-account resource link that sorts first -
failed Test Connection, and the metadata agent with it, since the source
runs the check before its own schema filter applies.

Filter while paging so excluded databases are never probed and a
targeted one past the probe cap is still reached, and pass each
database's CatalogId as ingestion does.
@Khairajani
Khairajani requested a review from a team as a code owner October 27, 2026 12:24
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Khairajani Khairajani changed the title Glue: honor schemaFilterPattern in the GetTables test-connection probe Fixes 36348: Glue test connection honors schemaFilterPattern Oct 27, 2026
…be too

The GetTables probe now matches what ingestion reads: databaseFilterPattern
against the catalog ID (skipped when databaseName is set, as ingestion does),
schemaFilterPattern against the Glue database name, and tableFilterPattern
against table names. A database whose tables are all filtered out no longer
counts, so the probe moves on to the next one.
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

…he table scan

GlueSource now scopes its startup test connection to the ingestion
pipeline's database, schema and table filters, matching fully qualified
names when useFqnForFiltering is set, as ingestion does. A pipeline that
sets a filter only on the agent no longer probes a database it excludes.
The connection's default patterns remain the fallback for a test run
outside a pipeline.

The table probe reads at most MAX_TABLES_TO_SCAN tables in total, so a
selective tableFilterPattern cannot scan a large catalog past the step
timeout. Adds tests for later pages, the probe cap and the scan budget.
Khairajani and others added 4 commits October 27, 2026 18:21
…ules

Running out of the table scan budget no longer reuses the 'ingestion
would collect nothing' caveat; it returns 'Table probe stopped early'.
Adds ADR:2026-10-27-glue-test-connection-probes-what-ingestion-reads for
the pipeline-scoped filters and the 1000-table budget.
Kept tables found before the probe's scan budget ran out are a floor,
not the database's total, so the summary now says the scan stopped.
…eline

WorkflowSource.serviceName is optional, which basedpyright flags at the
GlueSource call site.
…probe

A selective database or schema filter could page through a whole catalog
before finding a target; cap it at 1000 databases with the non-blocking
stopped-early caveat. Match the table filter on the first 128 characters of
the name, as ingestion does.
…at was found

Collecting targeted databases up front requested later pages even after the
first database could prove access. Reading one database past the budget also
stops a catalog of exactly the budget from being flagged as cut short.
After an empty probe, resuming the lazy database iterator can request the
next GetDatabases page; its failure was reported as the previous database's
GetTables. Also correct the decision record: a denied database the filters
keep still fails the check.
@Khairajani Khairajani changed the title Fixes 36348: Glue test connection honors schemaFilterPattern Fixes 36348: Glue test connection probes only what ingestion reads Oct 28, 2026
@gitar-bot

gitar-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 5 closed / 5 findings

🟡 Medium risk · The Glue startup probe now follows pipeline filters and bounded paging; stopping at one readable table could let ingestion start despite later unreadable databases.

Glue test-connection probe now applies the pipeline's database, schema, and table filters while paging, so it only reads what ingestion reads and skips denied databases. Scan budgets are bounded and caveats are worded accurately. Resolved the filter-source mismatch, budget-exhaustion messaging, lazy GetDatabases error attribution, and missing ADR coverage. No open issues found.

✅ 5 closed
✅ Bug: Probe filters by the connection pattern, but ingestion filters by sourceConfig's

📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:107 📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:186-190
GlueConnection.checks() passes service_connection.schemaFilterPattern (the connection's "Default Schema Filter Pattern") to the probe. GlueSource filters schemas with self.config.sourceConfig.config.schemaFilterPattern (metadata.py, filter_by_schema(...)), and honors useFqnForFiltering. Nothing at runtime copies one pattern into the other. A pipeline or YAML that sets only sourceConfig.config.schemaFilterPattern hits the bug from #36348 unchanged: the probe still reaches the denied first database, raises AccessDeniedException, and GlueSource.__init__ → test_connection() aborts the agent. The reverse also happens. A connection pattern that disagrees with the pipeline's can skip databases the pipeline would ingest, or probe ones it excludes. Fix: when GlueSource runs the check, hand it the source-config pattern, and match by schema FQN when useFqnForFiltering is set. Keep the connection-level pattern only as the fallback for the standalone UI test connection. Also add a test that drives the check through GlueSource with a sourceConfig-only filter.

✅ Edge Case: Running out of the scan budget is reported as 'ingestion would collect nothing'

📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:219-233
When budget reaches 0 at connection.py:231, the loop breaks and returns the same no tables in the first N databases summary and _no_tables_caveat() that an empty catalog gets. That caveat says "ingestion would collect nothing as configured". Example: a tableFilterPattern excludes ^tmp_ and the first database has 1,000 tmp_* tables followed by real ones. The probe stops after the 1,000th table and says ingestion would get nothing, which is false. It also never looks at the remaining targeted databases, so the user is sent off to debug filters and grants that are fine. Fix: track whether the budget ran out and return a separate caveat that says the probe stopped after reading MAX_TABLES_TO_SCAN tables without finding one the filters keep, rather than the 'collect nothing' message.

✅ Quality: New table-scan cap and pipeline-scoped probe rule are not recorded

📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:58-60 📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:280-288 📄 ingestion/src/metadata/ingestion/source/database/glue/metadata.py:111-114
This commit adds two rules and neither is in the tree. First, the cap MAX_TABLES_TO_SCAN = 1000, a judgment-call limit on how many tables a test-connection probe may read across all databases. The record would say: "The Glue GetTables probe reads at most 1000 tables in total, so a selective tableFilterPattern cannot outrun the step timeout." Second, a split in which filters the probe uses: "An ingestion run's startup test connection probes with the pipeline's database/schema/table filters (and useFqnForFiltering), while a standalone test connection probes with the connection's default patterns." Today that rule exists only as a comment at metadata.py:111 and in the scope_to wiring. No file in docs/decisions/ covers either rule. Please add a record under docs/decisions/ that states both.

✅ Edge Case: Database-budget caveat says every database was excluded when some were kept

📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:189-196 📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:251-259 📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:288-296
_targeted_databases can return (targeted, True) with a non-empty targeted list. For example, the schema filter keeps 3 empty databases among the first 1000 of a 5000-database catalog. list_tables probes those 3, finds no tables, and then takes the databases_cut_short branch, whose remediation reads "The filters excluded every database among the first 1000 read". That is false here: the filters kept 3 databases, and those databases had no tables. Users would then go and check databaseFilterPattern/schemaFilterPattern when the real cause is empty or unreadable kept databases. A catalog with exactly 1000 databases also gets flagged as cut short, because the scanned >= MAX_DATABASES_TO_SCAN check runs even though the listing has ended. Fix: only use the 'excluded every database' wording when databases is empty. Otherwise, say that N kept databases had no tables and that the scan stopped after 1000 databases.

✅ Edge Case: Lazy GetDatabases paging blames a later page failure on GetTables

📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:193-207 📄 ingestion/src/metadata/ingestion/source/database/glue/connection.py:242-256
_TargetedDatabases is now consumed lazily inside the try in list_tables, so the request for the next GetDatabases page only goes out after command has been reassigned to glue:GetTables (DatabaseName=<previous db>). Example: the first page's kept database has no tables, and the second GetDatabases page then fails with a throttle or AccessDenied. The resulting CheckError names GetTables on a database that worked fine, which sends the user to fix the wrong permission or database. Before this commit the listing finished before the loop started, so command was always glue:GetDatabases when a listing error was raised. Fix: have the iterator report its own failures, e.g. wrap its paging in try/except and raise CheckError(cause, Evidence(command="glue:GetDatabases")). list_tables must then re-raise a CheckError unchanged instead of wrapping it a second time.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@sonarqubecloud

Copy link
Copy Markdown

@Khairajani
Khairajani enabled auto-merge October 28, 2026 07:47
@Khairajani
Khairajani added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 5e06161 Oct 29, 2026
85 checks passed
@Khairajani
Khairajani deleted the fix/glue-test-connection-schema-filter branch October 29, 2026 14:38
Khairajani added a commit that referenced this pull request Oct 30, 2026
…36347) (#36575)

* Glue: honor schemaFilterPattern in the GetTables test-connection probe

The probe ran GetTables on the first databases GetDatabases returned,
ignoring the connection's schemaFilterPattern. A database the identity
cannot read - e.g. a cross-account resource link that sorts first -
failed Test Connection, and the metadata agent with it, since the source
runs the check before its own schema filter applies.

Filter while paging so excluded databases are never probed and a
targeted one past the probe cap is still reached, and pass each
database's CatalogId as ingestion does.

* Glue: apply the database and table filters in the test-connection probe too

The GetTables probe now matches what ingestion reads: databaseFilterPattern
against the catalog ID (skipped when databaseName is set, as ingestion does),
schemaFilterPattern against the Glue database name, and tableFilterPattern
against table names. A database whose tables are all filtered out no longer
counts, so the probe moves on to the next one.

* Glue: probe with the pipeline's filters during ingestion, and bound the table scan

GlueSource now scopes its startup test connection to the ingestion
pipeline's database, schema and table filters, matching fully qualified
names when useFqnForFiltering is set, as ingestion does. A pipeline that
sets a filter only on the agent no longer probes a database it excludes.
The connection's default patterns remain the fallback for a test run
outside a pipeline.

The table probe reads at most MAX_TABLES_TO_SCAN tables in total, so a
selective tableFilterPattern cannot scan a large catalog past the step
timeout. Adds tests for later pages, the probe cap and the scan budget.

* Glue: report a spent scan budget distinctly, and record the probe's rules

Running out of the table scan budget no longer reuses the 'ingestion
would collect nothing' caveat; it returns 'Table probe stopped early'.
Adds ADR:2026-10-27-glue-test-connection-probes-what-ingestion-reads for
the pipeline-scoped filters and the 1000-table budget.

* Glue: flag a table count cut short by the scan budget

Kept tables found before the probe's scan budget ran out are a floor,
not the database's total, so the summary now says the scan stopped.

* Glue: accept an optional service name when scoping the probe to a pipeline

WorkflowSource.serviceName is optional, which basedpyright flags at the
GlueSource call site.

* Glue: bound the database scan and match truncated table names in the probe

A selective database or schema filter could page through a whole catalog
before finding a target; cap it at 1000 databases with the non-blocking
stopped-early caveat. Match the table filter on the first 128 characters of
the name, as ingestion does.

* Glue: page databases lazily and word the database-budget caveat by what was found

Collecting targeted databases up front requested later pages even after the
first database could prove access. Reading one database past the budget also
stops a catalog of exactly the budget from being flagged as cut short.

* Glue: name GetDatabases when a later database page fails the probe

After an empty probe, resuming the lazy database iterator can request the
next GetDatabases page; its failure was reported as the previous database's
GetTables. Also correct the decision record: a denied database the filters
keep still fails the check.

(cherry picked from commit 5e06161)
Khairajani added a commit that referenced this pull request Oct 30, 2026
…36347) (#36574)

* Glue: honor schemaFilterPattern in the GetTables test-connection probe

The probe ran GetTables on the first databases GetDatabases returned,
ignoring the connection's schemaFilterPattern. A database the identity
cannot read - e.g. a cross-account resource link that sorts first -
failed Test Connection, and the metadata agent with it, since the source
runs the check before its own schema filter applies.

Filter while paging so excluded databases are never probed and a
targeted one past the probe cap is still reached, and pass each
database's CatalogId as ingestion does.

* Glue: apply the database and table filters in the test-connection probe too

The GetTables probe now matches what ingestion reads: databaseFilterPattern
against the catalog ID (skipped when databaseName is set, as ingestion does),
schemaFilterPattern against the Glue database name, and tableFilterPattern
against table names. A database whose tables are all filtered out no longer
counts, so the probe moves on to the next one.

* Glue: probe with the pipeline's filters during ingestion, and bound the table scan

GlueSource now scopes its startup test connection to the ingestion
pipeline's database, schema and table filters, matching fully qualified
names when useFqnForFiltering is set, as ingestion does. A pipeline that
sets a filter only on the agent no longer probes a database it excludes.
The connection's default patterns remain the fallback for a test run
outside a pipeline.

The table probe reads at most MAX_TABLES_TO_SCAN tables in total, so a
selective tableFilterPattern cannot scan a large catalog past the step
timeout. Adds tests for later pages, the probe cap and the scan budget.

* Glue: report a spent scan budget distinctly, and record the probe's rules

Running out of the table scan budget no longer reuses the 'ingestion
would collect nothing' caveat; it returns 'Table probe stopped early'.
Adds ADR:2026-10-27-glue-test-connection-probes-what-ingestion-reads for
the pipeline-scoped filters and the 1000-table budget.

* Glue: flag a table count cut short by the scan budget

Kept tables found before the probe's scan budget ran out are a floor,
not the database's total, so the summary now says the scan stopped.

* Glue: accept an optional service name when scoping the probe to a pipeline

WorkflowSource.serviceName is optional, which basedpyright flags at the
GlueSource call site.

* Glue: bound the database scan and match truncated table names in the probe

A selective database or schema filter could page through a whole catalog
before finding a target; cap it at 1000 databases with the non-blocking
stopped-early caveat. Match the table filter on the first 128 characters of
the name, as ingestion does.

* Glue: page databases lazily and word the database-budget caveat by what was found

Collecting targeted databases up front requested later pages even after the
first database could prove access. Reading one database past the budget also
stops a catalog of exactly the budget from being flagged as cut short.

* Glue: name GetDatabases when a later database page fails the probe

After an empty probe, resuming the lazy database iterator can request the
next GetDatabases page; its failure was reported as the previous database's
GetTables. Also correct the decision record: a denied database the filters
keep still fails the check.

(cherry picked from commit 5e06161)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glue test connection ignores schemaFilterPattern and fails on a database the filter excludes

2 participants