OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

"Edit Connection" table/schema/database filter save silently patches the wrong entity (never read by ingestion)

Open fmcardoso opened this issue 2 months ago • 1 comments

Summary

Editing table/schema/database filter patterns from a database service's "Edit Connection" page saves the pattern onto the wrong entity. The ingestion pipeline's Python runtime never reads that field, so the save has no effect on which tables/schemas get scanned — even though the UI shows a success toast and the filter chip appears saved ("Excluding N rules").

Repro

  1. Have an existing database service with a deployed metadata ingestion pipeline (e.g. a Redshift connector).
  2. From the service's connection settings, open Edit Connection.
  3. In the "Tables" (or Schemas/Databases) filter card, add an exclude rule (e.g. contains big_ctas_data) and hit Save. UI shows the rule as saved ("Excluding N rules").
  4. Query the ingestion pipeline entity: GET /api/v1/services/ingestionPipelines/name/{fqn}. Its sourceConfig.config.tableFilterPattern.excludes is unchanged — no trace of the new rule, and updatedAt on the pipeline does not move.
  5. Trigger (or wait for) the pipeline run. It processes the table/schema the exclude rule was meant to skip, exactly as if the rule were never added.

Root cause

Filter patterns exist on two independent entities, and "Edit Connection" writes to the one the ingestion runtime never reads for an existing pipeline.

1. Connection.config.tableFilterPattern (e.g. RedshiftConnection.tableFilterPattern, openmetadata-spec/.../connections/database/redshiftConnection.json) — what "Edit Connection" writes to:

  • EditConnectionFormPage.component.tsx's handleFiltersSave merges the form data into connection.config and calls patchService(serviceCategory, serviceDetails.id, jsonPatch) (rest/serviceAPI.ts) — a PATCH /api/v1/services/{serviceCategory}/{id}.
  • The form itself is FiltersConfigForm.tsx (components/Settings/Services/ServiceConfig/FiltersConfigForm.tsx); its onSave prop is wired directly to handleFiltersSave from EditConnectionFormPage.
  • AddServicePage.component.tsx / EmbeddedAddServicePage.component.tsx (the create flow) have the same behavior — they also just PATCH/POST the service's connection.config. There is no UI-level pipeline seeding in the OSS create flow; any pipeline creation there is delegated server-side to an "AutoPilot" app trigger.

2. IngestionPipeline.sourceConfig.config.tableFilterPattern — the pipeline's own config, a separate entity at /api/v1/services/ingestionPipelines/{id}. The Python ingestion framework only reads this:

  • ingestion/src/metadata/ingestion/source/database/common_db_source.py and database_service.py: self.source_config: DatabaseServiceMetadataPipeline = self.config.sourceConfig.config; every filter_by_table/filter_by_schema/filter_by_database call reads self.source_config.*FilterPattern. Grepping all of ingestion/src for service_connection.tableFilterPattern / connection.tableFilterPattern returns zero hits for any connector.
  • Traced source_config's origin server-side: openmetadata-service/.../clients/pipeline/config/WorkflowConfigBuilder.java: source.setSourceConfig(ingestionPipeline.getSourceConfig()) — built from the IngestionPipeline entity's own field, a completely separate schema tree from serviceConnection (populated instead from the service entity's connection, per ingestion/src/metadata/workflow/ingestion.py).
  • ingestion/src/metadata/utils/filters.py: a single shared _filter() backs every filter_by_* helper, and both include and exclude branches use re.match (start-anchored, not full-string search) — a UI "contains X" rule needs to compile to .*X.*, not a bare substring, or it silently behaves like "starts with" instead.

The one place the connection-level field is read: openmetadata-service/.../governance/workflows/elements/nodes/automatedTask/createAndRunIngestionPipeline/CreateIngestionPipelineImpl.java copies connection.config.{table,schema,database}FilterPattern into a brand-new pipeline's sourceConfig when AutoPilot auto-provisions one. That's a one-time seed at creation time — after that, the connection-level field plays no further role in filtering. So it's not "fully dead code" in the strictest sense, but it is correctly inert for editing an already-existing pipeline's filters via "Edit Connection", which is what this issue is about.

Where filters actually need to be edited

The pipeline's own edit screen — service → Ingestion/Agents tab → the pipeline row → Edit — is EditIngestionPage.component.tsx, whose onEditIngestionSave calls updateIngestionPipeline (rest/ingestionPipelineAPI.ts), a PATCH /api/v1/services/ingestionPipelines/{id}. Its form, IngestionWorkflowForm.tsx, reuses the same FilterPatternField widget as FiltersConfigForm.tsx — visually identical filter UI, silently targeting a different backend entity depending on which page it's on. That's almost certainly why this wasn't caught by inspection: both screens look and behave identically to a user.

Suggested directions (not prescribing one)

  • (a) Once a pipeline exists for the service, hide/disable the filter card on "Edit Connection" and point users at "Edit Ingestion" instead, or
  • (b) make the "Edit Connection" save also PATCH the pipeline's sourceConfig (handling services with zero or multiple pipelines) so the save does what the UI currently implies.

Verification once fixed

Repeat the repro above; step 4 should show sourceConfig.config.tableFilterPattern updated after saving from "Edit Connection" (if (b)), or the filter UI should no longer appear on that screen once a pipeline exists (if (a)).

Cross-filed

The same bug exists independently in Collate's own frontend (collate-local-webserver), which reimplements this page with different plumbing. Filed separately: open-metadata/openmetadata-collate#TBD

fmcardoso avatar Sep 08 '26 15:09 fmcardoso

Cross-filed for Collate's own frontend (collate-local-webserver), which independently reimplements this page and has the same bug: open-metadata/openmetadata-collate#6460

fmcardoso avatar Sep 08 '26 15:09 fmcardoso