Skip to content

Fixes 36674: Add default system-schema filters for database connectors - #36677

Merged
ulixius9 merged 4 commits into
mainfrom
ulixius9/connector-default-filters-missing
Nov 4, 2026
Merged

ulixius9 merged 4 commits into
mainfrom
ulixius9/connector-default-filters-missing

Conversation

@ulixius9

@ulixius9 ulixius9 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36674

Most database connectors had no databaseFilterPattern / schemaFilterPattern default, so new ingestion pipelines pulled in engine catalogs such as information_schema, system, _impala_builtins and Mongo admin/local/config. This PR adds exact-name system-schema excludes to 20 connection schemas, plus a unit test and a decision record. The defaults only pre-fill filters on newly created pipelines. Ingestion reads filters from the pipeline's own sourceConfig, so existing pipelines are unchanged.

Type of change:

  • Improvement

High-level design:

  • What changed: only the JSON Schemas changed. Each default goes on the connection-level filter, which the UI add-ingestion form (getDefaultFilterPropertyValues, create mode only) and CreateIngestionPipelineImpl copy into a new pipeline's sourceConfig. None of the 20 connectors reads the connection-level filters at runtime; only Snowflake, Databend and Athena do, and they are untouched.
Connector Database excludes Schema excludes
mariaDB, singleStore — information_schema, performance_schema
doris — the above + __internal_schema
greenplum template0, template1 information_schema, gp_toolkit
cockroach system information_schema, crdb_internal, pg_extension
azureSQL, synapse msdb, model, tempdb the nine fixed db_* roles by name, guest, information_schema, sys
clickhouse — system, information_schema
trino, presto system (catalog) information_schema
sapHana — SYS, _SYS_(?!BIC$).*
db2 — SYS(CAT|FUN|IBM|IBMADM|IBMINTERNAL|IBMTS|PROC|PUBLIC|STAT|TOOLS), NULLID, SQLJ
teradata — DBC, SYS_CALENDAR, SYSLIB, TD_SYS.*, TDSTATS, … (28 patterns)
exasol — SYS, EXA_STATISTICS
cassandra — system, system_auth, system_schema, system_distributed, system_traces, system_views, system_virtual_schema
mongoDB — admin, local, config
couchbase — _system
impala — _impala_builtins
druid — INFORMATION_SCHEMA, sys
hive — sys, information_schema
  • Judgment calls, recorded in ADR:2026-10-30-database-connection-defaults-exclude-system-schemas:
    • Patterns are anchored exact names. No ^SYS.*, ^system_.* or ^db_.*, which would hide user schemas such as SYSTEM_DATA, system_logs or db_staging.
    • SAP HANA keeps _SYS_BIC, because its lineage resolves calculation views there.
    • Vertica and StarRocks are skipped: the Vertica dialect already drops v_* schemas, and the StarRocks source already filters its system schemas in code.
  • Migration / back-compat: none needed. No stored data changes; existing pipelines keep their saved filters. An existing service picks up the defaults in its connection form only when a user re-saves it, and even then they only seed new pipelines.

Tests:

Use cases covered

  • A new pipeline on these connectors excludes the engine's system databases/schemas by default.
  • User schemas that look like system names are still ingested (system_logs, SYSTEM_DATA, configs, _SYS_BIC, DBC_COPY, …).

Unit tests

  • Added ingestion/tests/unit/test_connection_default_filters.py: 26 parametrized cases. Each loads the schema's default and runs it through metadata.utils.filters.filter_by_schema / filter_by_database, asserting the system names are excluded and the look-alike user names are kept. Result: pytest tests/unit/test_connection_default_filters.py → 26 passed.
  • The change is schema data only (no Python/Java source changes), so there is no coverage % to report.

Backend integration tests

  • Not applicable (no backend API changes). Impacted Java tests are below.

Local Java test run: unit PASSED · integration skipped (author's call)

  • Unit (openmetadata-service): ClassConverterFactoryTest 26/26 · HiveConnectionClassConverterTest 4/4 · PasswordEntityMaskerTest 23/23.
  • Integration: skipped for this PR. Only JSON default values change, and no IT asserts on them. A first run of the 24 impacted ITs at c4ec14cd470 failed in 14 tests, all environmental: "Connection refused" to the test server mid-run, and a missing data-consumer fixture user. On re-run TableResourceIT (55/55) and ServiceLineagePipelineRoutingMigrationIT (8/8) passed. The 4 data-consumer / built-in-metadata-service failures remained and were not baselined against main.

Ingestion integration tests

  • Not applicable: no ingestion/src changes, only a new unit test.

Playwright (UI) tests

  • Not applicable (no UI code changes; the add-ingestion form already reads connection defaults).

Manual testing performed

  1. Counted every connections/database/*Connection.json with filter-pattern properties: 59 total, 47 with no database/schema default before this PR.
  2. For each connector touched, checked how it lists schemas (source code and the installed SQLAlchemy dialect) to confirm the system schemas are actually returned and not already filtered.
  3. Confirmed that pipelines read filters from sourceConfig, and that the UI uses connection defaults only in create mode (IngestionConfigUtils.getDefaultFilterPropertyValues).

UI screen recording:

Not applicable — schema-default change with no UI code changes.

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 #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (Not needed: only default values are added, nothing stored changes, and existing pipelines keep their saved filters.)

  • For a UI feature or feature task: Not applicable.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    Reviewed bfe1bb941a8: no 🔴. Fixed the 🟡 findings in c4ec14cd470: ^db_.* narrowed to the nine fixed SQL Server roles, with db_staging added as a kept case, and the default-block indentation in cassandra/mongoDB/impala corrected. Bundled UI schemas (public/jsons/, src/jsons/) are left to the typescript-type-generation bot (yarn parse-schema).

  • Decision check: adds docs/decisions/2026-10-30-database-connection-defaults-exclude-system-schemas.md.

  • I have added tests around the new logic.

  • For connector/ingestion changes: I updated the documentation.

🤖 Generated with Claude Code

Add connection-level databaseFilterPattern/schemaFilterPattern defaults
that exclude engine-owned system databases/schemas for 20 database
connectors that had none (or an incomplete one). Defaults only pre-fill
filters of newly created ingestion pipelines.
^db_.* also hid user schemas such as db_staging on Azure SQL and Synapse.
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 30, 2026
@ulixius9

Copy link
Copy Markdown
Member Author

Local Java test run: FAILED — details

  • Commit: c4ec14cd4704 (base origin/main)
  • The summary is in the PR description.

Failed: MetadataServiceResourceIT#builtInOpenMetadataService_hasNoEsSinkOrStoredBotToken, MetadataServiceResourceIT#serviceConnection_maskedForEditor_nullForViewer_fullForBot(TestNamespace), ServiceLineagePipelineRoutingMigrationIT#, ServicesOverviewResourceIT#aNonAdminSeesTheServiceTypesTheyArePermitted(TestNamespace), TableResourceIT#test_deletedColumnWithoutStoredFqnDoesNotAbortUpdate(HttpMethod, TestNamespace)[2], TableResourceIT#test_bulkColumnDeleteLineagePropagatesInSearch(TestNamespace), TableResourceIT#test_revertedColumnRenameWithinSessionPropagatesInSearch(TestNamespace), TableResourceIT#test_sessionAddedColumnKeepsLineageThroughConsolidation(TestNamespace), TableResourceIT#test_deletedColumnWithoutStoredFqnDoesNotAbortUpdate(HttpMethod, TestNamespace)[1], TableResourceIT#test_tableLineage(TestNamespace), TableResourceIT#test_deletedColumnKeepsLineageSqlQuery(TestNamespace), TableResourceIT#test_domainPropagationToSearchIndex(TestNamespace), TableResourceIT#test_multipleDomainInheritance(TestNamespace), TableResourceIT#test_searchTableColumns_comprehensive(TestNamespace)

Selected but produced no report: McpServiceResourceIT (mysql-elasticsearch · parallel)

Tests run locally

  • unit · openmetadata-service (3 classes): ClassConverterFactoryTest (26 passed), HiveConnectionClassConverterTest (4 passed), PasswordEntityMaskerTest (23 passed)
  • integration · mysql-elasticsearch · parallel: APIServiceResourceIT (7 passed, 1 skipped), BaseEntityIT$ListEntityHistoryByTimestampPaginationTest (109 passed, 13 skipped), ConfigResourceIT (15 passed), DashboardServiceResourceIT (25 passed, 5 skipped), DatabaseServiceResourceIT (6 passed, 2 skipped), DatabaseSmokeIT (34 passed, 3 skipped), DriveServiceResourceIT (3 passed, 1 skipped), GlossaryTermResourceIT (215 passed, 7 skipped), LLMServiceResourceIT (114 passed, 24 skipped), MessagingServiceResourceIT (6 passed), MetadataServiceResourceIT (39 passed, 7 skipped), MlModelServiceResourceIT (115 passed, 18 skipped), MlModelServiceSearchAliasIT (40 passed, 8 skipped), PipelineServiceResourceIT (35 passed, 6 skipped), SearchServiceResourceIT (63 passed, 11 skipped), SecurityServiceResourceIT (65 passed, 10 skipped), SeedDataPresenceIT (22 passed, 5 skipped), ServiceAttributePolicyIT (169 passed, 14 skipped), ServiceLineagePipelineRoutingMigrationIT (0 passed, 1 failed), ServiceLineageRefcountIT (39 passed, 9 skipped), ServicesOverviewResourceIT (72 passed, 1 failed, 5 skipped), StorageServiceResourceIT (730 passed, 131 skipped), TableResourceIT (24 passed, 10 failed), UserResourceIT (304 passed, 20 skipped)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Why these tests
  • area services ← openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/azureSQLConnection.json, openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/cassandraConnection.json, openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/clickhouseConnection.json, openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/cockroachConnection.json, openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/couchbaseConnection.json (+15 more)
  • smoke ← code other than a test class changed
Impacted, not run locally (1)
  • ServiceDeleteSearchCleanupScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=ClassConverterFactoryTest,HiveConnectionClassConverterTest,PasswordEntityMaskerTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=APIServiceResourceIT,ConfigResourceIT,DashboardServiceResourceIT,DatabaseServiceResourceIT,DatabaseSmokeIT,DriveServiceResourceIT,GlossaryTermResourceIT,LLMServiceResourceIT,McpServiceResourceIT,MessagingServiceResourceIT,MetadataServiceResourceIT,MlModelServiceResourceIT,MlModelServiceSearchAliasIT,PipelineServiceResourceIT,SearchServiceResourceIT,SecurityServiceResourceIT,SeedDataPresenceIT,ServiceAttributePolicyIT,ServiceLineagePipelineRoutingMigrationIT,ServiceLineageRefcountIT,ServicesOverviewResourceIT,StorageServiceResourceIT,TableResourceIT,UserResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@ulixius9
ulixius9 marked this pull request as ready for review October 30, 2026 11:03
@ulixius9
ulixius9 requested a review from a team as a code owner October 30, 2026 11:04
@ulixius9
ulixius9 requested review from mohittilala and a balanced review from Copilot October 30, 2026 11:04

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 11:09

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
80.97% (137064/169263) 67.88% (49184/72453) 70.93% (27686/39029)

Copilot AI balanced review requested due to automatic review settings November 2, 2026 12:54

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Comment on lines +27 to +34
- No default is added where it would be a no-op: the Vertica dialect already drops `v_*` schemas
and the StarRocks source already skips its system schemas in code.

## Consequences
New pipelines no longer ingest engine catalogs by default; users can still clear the default.
Existing pipelines are untouched. A connector added later should ship its system-schema default
in the same PR. Matching is case-insensitive (`filters._filter` uses `re.IGNORECASE`), so one
pattern covers engines that upper-case their catalog names.

@gitar-bot gitar-bot Bot Nov 2, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Quality: ADR omits rule: no default where connection filters are read at runtime

The description excludes connectors on purpose: "Snowflake, Databend and Athena, which read connection-level filters at runtime, are untouched." The tree does not record this rule. Those sources do read the connection field at runtime (databend/connection.py:133 calls filter_by_schema(self.service_connection.schemaFilterPattern, …), athena/connection.py:327 passes service_connection.schemaFilterPattern, and glue/connection.py:136-137 does the same). Generated models apply schema defaults whenever the field is missing, so a default on those connections would quietly change filtering for existing services. That would break the ADR's "Existing pipelines are untouched" consequence.

The new ADR does the opposite of protecting this. Its Consequences section says "A connector added later should ship its system-schema default in the same PR", and its only listed exception is the no-op case (Vertica/StarRocks). Someone following the ADR could add a default to Athena, Databend or Glue and change how live services behave. The record should say something like: "A connector that reads schemaFilterPattern/databaseFilterPattern from the service connection at runtime (Snowflake, Databend, Athena, Glue) gets no new default, because the default would apply to existing services, not only to new pipelines."

Add the runtime-read exclusion to the ADR's Decision list.:

- No default is added where the connector reads the connection-level `schemaFilterPattern` /
  `databaseFilterPattern` at runtime (Snowflake, Databend, Athena, Glue): there the default would
  apply to every existing service, not only pre-fill new pipelines.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 closed / 1 findings

🟡 Medium risk · Adding default system-schema exclusions across 20 connectors may omit catalog metadata from new ingestion pipelines if a needed schema is misclassified.

Adds exact-name system-schema default filters to 20 database connector JSON Schemas so new ingestion pipelines skip engine catalogs like information_schema, system, and Mongo admin/local/config, plus a unit test and decision record.

Changes are requested because the ADR does not record that connectors reading schemaFilterPattern/databaseFilterPattern from the service connection at runtime (Snowflake, Databend, Athena, Glue) must not receive a default, since it would change filtering for existing services; the ADR's guidance to add defaults in future connector PRs could lead to that regression.

⚠️ Quality: ADR omits rule: no default where connection filters are read at runtime

📄 docs/decisions/2026-10-30-database-connection-defaults-exclude-system-schemas.md:27-34

The description excludes connectors on purpose: "Snowflake, Databend and Athena, which read connection-level filters at runtime, are untouched." The tree does not record this rule. Those sources do read the connection field at runtime (databend/connection.py:133 calls filter_by_schema(self.service_connection.schemaFilterPattern, …), athena/connection.py:327 passes service_connection.schemaFilterPattern, and glue/connection.py:136-137 does the same). Generated models apply schema defaults whenever the field is missing, so a default on those connections would quietly change filtering for existing services. That would break the ADR's "Existing pipelines are untouched" consequence.

The new ADR does the opposite of protecting this. Its Consequences section says "A connector added later should ship its system-schema default in the same PR", and its only listed exception is the no-op case (Vertica/StarRocks). Someone following the ADR could add a default to Athena, Databend or Glue and change how live services behave. The record should say something like: "A connector that reads schemaFilterPattern/databaseFilterPattern from the service connection at runtime (Snowflake, Databend, Athena, Glue) gets no new default, because the default would apply to existing services, not only to new pipelines."

Add the runtime-read exclusion to the ADR's Decision list.
- No default is added where the connector reads the connection-level `schemaFilterPattern` /
  `databaseFilterPattern` at runtime (Snowflake, Databend, Athena, Glue): there the default would
  apply to every existing service, not only pre-fill new pipelines.
🤖 Prompt for agents
Code Review: Adds exact-name system-schema default filters to 20 database connector JSON Schemas so new ingestion pipelines skip engine catalogs like `information_schema`, `system`, and Mongo `admin`/`local`/`config`, plus a unit test and decision record.
  
  Changes are requested because the ADR does not record that connectors reading `schemaFilterPattern`/`databaseFilterPattern` from the service connection at runtime (Snowflake, Databend, Athena, Glue) must not receive a default, since it would change filtering for existing services; the ADR's guidance to add defaults in future connector PRs could lead to that regression.

1. ⚠️ Quality: ADR omits rule: no default where connection filters are read at runtime
   Files: docs/decisions/2026-10-30-database-connection-defaults-exclude-system-schemas.md:27-34

   The description excludes connectors on purpose: "Snowflake, Databend and Athena, which read connection-level filters at runtime, are untouched." The tree does not record this rule. Those sources do read the connection field at runtime (`databend/connection.py:133` calls `filter_by_schema(self.service_connection.schemaFilterPattern, …)`, `athena/connection.py:327` passes `service_connection.schemaFilterPattern`, and `glue/connection.py:136-137` does the same). Generated models apply schema defaults whenever the field is missing, so a default on those connections would quietly change filtering for existing services. That would break the ADR's "Existing pipelines are untouched" consequence.
   
   The new ADR does the opposite of protecting this. Its Consequences section says "A connector added later should ship its system-schema default in the same PR", and its only listed exception is the no-op case (Vertica/StarRocks). Someone following the ADR could add a default to Athena, Databend or Glue and change how live services behave. The record should say something like: "A connector that reads `schemaFilterPattern`/`databaseFilterPattern` from the service connection at runtime (Snowflake, Databend, Athena, Glue) gets no new default, because the default would apply to existing services, not only to new pipelines."

   Fix (Add the runtime-read exclusion to the ADR's Decision list.):
   - No default is added where the connector reads the connection-level `schemaFilterPattern` /
     `databaseFilterPattern` at runtime (Snowflake, Databend, Athena, Glue): there the default would
     apply to every existing service, not only pre-fill new pipelines.

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

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@Khairajani Khairajani 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.

LGTM. Nit: worth one line in the ADR on why Snowflake, Databend and Athena get no default (they read connection-level filters at runtime).

@ulixius9
ulixius9 merged commit 85165d5 into main Nov 4, 2026
77 of 78 checks passed
@ulixius9
ulixius9 deleted the ulixius9/connector-default-filters-missing branch November 4, 2026 11:43
harshsoni2024 pushed a commit that referenced this pull request Nov 5, 2026
… test (#37097)

* Fix nightly ingestion integration tests broken by connector defaults and BigQuery usage resolution

- ometa workflow fixture: set MysqlConnection.type explicitly. The dump
  excludes unset fields, so without the discriminator the untagged
  DatabaseConnection union resolved to TrinoConnection once Trino gained
  default filter patterns (#36677).
- test_sample_usage: sample_data is a BigQuery service, and BigQuery usage
  resolution (#36867) rewrites references to database.schema.table, so
  expect those keys. Assert the whole map so a miss shows what was found.

* Fix flaky Alation sink clock tests that patched the global time.monotonic

Patching `client.time.monotonic` replaces the attribute on the shared `time`
module, so any background thread (a leftover pymongo cursor reaper on the 3.10
unit job) consumed the fake ticks; the exhausted iterator raised StopIteration,
which _write_batch reported as an empty error. Patch the client module's `time`
binding instead.
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database connectors are missing default system-schema filter patterns

3 participants