Skip to content

fix(unitycatalog): remove databaseSchema from the Unity Catalog connection - #38180

Closed
akashverma0786 wants to merge 5 commits into
mainfrom
fix/unitycatalog-remove-databaseschema
Closed

akashverma0786 wants to merge 5 commits into
mainfrom
fix/unitycatalog-remove-databaseschema

Conversation

@akashverma0786

@akashverma0786 akashverma0786 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

No linked issue: found by a live audit of the Unity Catalog connector against a Databricks workspace.

databaseSchema on the Unity Catalog connection restricts nothing.

Fix: remove the field.

  • unityCatalogConnection.json no longer has databaseSchema. Schemas are selected with schemaFilterPattern, which ingestion applies.
  • Test Connection probes the first schema the resolved catalog lists. Its messages no longer refer to a configured schema.
  • The connection schema sets additionalProperties: false, so a stored row that still carries the key would stop loading: the server rejects it with Unrecognized field "databaseSchema" and ingestion with extra_forbidden. The 2.1.0 migration removes connection.config.databaseSchema from every stored copy, on MySQL and Postgres: SQL repairs Unity Catalog services and their databaseService.version.* snapshots, and the data migration UnityCatalogDatabaseSchemaMigration repairs saved Test Connection requests in id batches. Databricks connections keep their own databaseSchema, so every step is scoped to Unity Catalog. New record: ADR:2026-11-19-unity-catalog-connections-have-no-database-schema.

Behavior changes to note in the release:

  • A workflow YAML that still sets databaseSchema on a Unity Catalog connection fails validation (Extra parameter 'databaseSchema') and must drop the key; use schemaFilterPattern: {includes: ["^<schema>$"]} to ingest one schema. Services stored in OpenMetadata are repaired by the migration.
  • Test Connection can no longer be pointed at a chosen schema. When the principal cannot read the first listed schema, the mandatory GetTables step fails.

Type of change:

  • Bug fix
  • Backward-incompatible change (removes a connection field; see above)

High-level design:

  • Schema-first. The spec change is regenerated into the Pydantic models, the UI connection form schemas (yarn parse-schema output: public/jsons/... and src/jsons/ingestionSchemas/...) and the TypeScript type (json2ts.sh). Only the hunks that remove this field are kept: the generators also rewrite unrelated $ref paths and drop license headers in files they touch.
  • Migration.
    • Services and snapshots: two statements appended to 2.1.0/{mysql,postgres}/postDataMigrationSQLScript.sql, the release in progress, as the sampleDataStorageConfig and Microsoft Fabric clientSecret removals there do. Each is idempotent (it matches only rows that still carry the key). The snapshot statement joins dbservice_entity on the service id, the leading primary-key column of entity_extension, so version history is not scanned.
    • Saved Test Connection requests: nothing indexes a request's connection type, so a v210 data migration walks automations_workflow with IdBatches (500 ids per batch, keyset on the primary key, ADR:2026-10-09-data-migration-backfills-walk-ids-in-batches) and updates only the Unity Catalog requests of each batch. It runs once through runOnce, recorded as a data migration step.
    • DataAssetChartScopeSqlMigrationTest read the 2.1.0 script from its section marker to the end of the file, so it counted statements appended after its section as its own. Its section now ends with its last chart statement.
  • Alternatives rejected: making the field restrict ingestion. It duplicates schemaFilterPattern, and a cleanup scoped to one schema can then delete live sibling schemas.

Tests:

Use cases covered

  • Test Connection uses the first schema the catalog lists and reports schemas.list().
  • Migration, on MySQL 8.0.46 and PostgreSQL 16 with several rows per table: Unity Catalog services (key with a value, key set to null, no key), their version snapshots and Test Connection requests lose the key and keep every other field; Databricks rows and unrelated extension rows keep theirs; a second run changes no row.
  • Saved requests over three id batches (1,001 rows): the Unity Catalog requests in every batch lose the key, the Databricks one keeps it, a second run changes nothing.

Unit tests

  • Added: UnityCatalogDatabaseSchemaMigrationTest, against real MySQL 8.0 and PostgreSQL 15 containers. Fixed: DataAssetChartScopeSqlMigrationTest bounds its section.
  • Updated: unitycatalog/test_connection.py (the configured-schema test now checks the listed schema), test_unity_catalog_connection.py (the configured-schema test is removed), and the fixtures of test_unity_catalog.py, test_unity_catalog_lineage.py and test_unitycatalog_error_isolation.py, which set the removed key.
  • Ran every unit test file that mentions Unity Catalog: 584 passed; the 1 collection error is test_source_connection.py, which imports drivers missing from the local venv (trino, oracledb). Its Unity Catalog URL tests do not set the field and fail the same way locally on main.
  • ruff check / ruff format --check clean; basedpyright on unitycatalog/connection.py: 0 errors.

Backend integration tests

  • The SQL was run on real databases (above): MySQL 8.0.46 tables created LIKE the OpenMetadata ones, and PostgreSQL 16 tables with the bootstrap DDL. EXPLAIN uses PRIMARY (MySQL) and entity_extension_pkey (PostgreSQL) for the snapshot statement.
  • The new UnityCatalogConnection POJO, built from this branch, loads a migrated row and rejects an unmigrated one with Unrecognized field "databaseSchema"; DatabricksConnection still loads databaseSchema.
  • Focused local run: UnityCatalogDatabaseSchemaMigrationTest, every test that reads or parses the 2.1.0 script, the v210 Migration tests and NestedSecretConverterCoverageTest, which walks UnityCatalogConnectionClassConverter: 102 tests passed.
  • Integration tests in the migration and service areas run in the merge queue.

Local Java test run: PASSED

  • Commit: d7b5c208140b (base origin/main) — uncommitted changes were present
  • Finished: 2026-11-20 07:22 UTC · 5.1 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 5 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (11 classes) 11 102 0 0 5.1 passed
  • Impacted, not run locally: 1 class (listed in the details)

Ingestion integration tests

  • Not applicable: there is no tests/integration/ suite for Unity Catalog. Real ingestion runs are listed below.

Playwright (UI) tests

  • Not applicable: the form is generated from the schema; the only UI changes are generated files and the connector doc.

Manual testing performed

Real metadata ingest runs against a live Databricks workspace and a local OpenMetadata server, on one fresh service:

  1. Before: main code with databaseSchema: qa_uc_pg stored on the service. Both schemas ingested (18 + 59 tables).
  2. This branch, connection loaded from the server, before the migration: fails with extra_forbidden at UnityCatalogConnection.databaseSchema.
  3. The migration statements: the service row repaired.
  4. This branch, connection loaded from the server, after the migration: all seven Test Connection steps pass, 77 tables, 100 % success.
  5. This branch with databaseSchema still in the YAML: fails with Extra parameter 'databaseSchema'.
  6. openmetadata-ops.sh migrate from this branch's build on a MySQL database that had already run 2.1.0 without this change, holding a Unity Catalog service with the key, its snapshot and 1,105 saved requests (3 Unity Catalog with the key across three batches, 1 Databricks with it): 2.1.0 is reprocessed, the service and snapshot lose the key, the data migration logs Removed databaseSchema from 3 saved Unity Catalog Test Connection request(s), the Databricks request keeps it. A second migrate skips the step and changes nothing.

UI screen recording:

Not applicable: a connection field removed from a generated form.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>: no issue, found by a live connector audit.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above: same.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts and regenerated the models.
  • 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 (migrations: both engines, idempotent, index-usable entity_extension predicate, snapshots rewritten, legacy null handled, the growing automations_workflow walked in id batches).
  • Decision check: adds docs/decisions/2026-11-19-unity-catalog-connections-have-no-database-schema.md.

RetriggerView in GreptileConfidence Score: 4/5

The PR should not merge until the existing workflow-history finding is fixed.

Findings

  1. P1 Test Connection history stops loading ▶

Summary

Removes the unused databaseSchema connection field from Unity Catalog.

  • Unity Catalog connections no longer offer databaseSchema.
  • Test Connection probes the first schema the catalog lists.
  • The 2.1.0 upgrade removes the old setting from saved Unity Catalog records.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Unity Catalog schema drops databaseSchema] --> B[Generated models and connection forms]
  C[Upgrade] --> D[SQL cleans services and service versions]
  C --> E[Java walks saved requests in ID batches]
  F[Test Connection] --> G[List schemas]
  G --> H[Probe first named schema]
Loading

Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

The Unity Catalog source always listed every schema and never read
databaseSchema; only Test Connection used it to pick the schema it probes.
Remove it from unityCatalogConnection.json. Test Connection now probes the
first schema the catalog lists, and schemaFilterPattern selects schemas.

The 2.1.0 migration strips connection.config.databaseSchema from Unity
Catalog services, their version snapshots and saved Test Connection
requests on MySQL and Postgres, so stored rows keep loading under
additionalProperties: false. Databricks connections are left alone.
@akashverma0786
akashverma0786 requested a review from a team as a code owner November 19, 2026 07:42
@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.

@akashverma0786

Copy link
Copy Markdown
Collaborator Author

Local Java test run: PASSED — details

  • Commit: 48997608c7de (base origin/main) — uncommitted changes were present
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (1 class): NestedSecretConverterCoverageTest (1 passed)

Broader coverage not executed by this focused run

  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<52 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,MetricMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel '-Dit.test=<33 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,MetricMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Why these tests
  • added by author: unityCatalogConnection.json loses databaseSchema; this test walks every connection converter, UnityCatalogConnectionClassConverter included ← NestedSecretConverterCoverageTest
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=NestedSecretConverterCoverageTest -Dsurefire.failIfNoSpecifiedTests=false

@akashverma0786 akashverma0786 added Ingestion skip-pr-checks Bypass PR metadata validation check labels Nov 19, 2026
…atements

DataAssetChartScopeSqlMigrationTest read the 2.1.0 script from its section
marker to the end of the file, so any statement appended after the section,
such as the Unity Catalog databaseSchema cleanup, was counted as its own.
The section now ends with its last chart UPDATE.
…equests in id batches

Nothing indexes a saved request's connection type, so the single SQL update
read all of automations_workflow at once. A v210 data migration now walks the
table with IdBatches, 500 ids at a time, and removes the key from Unity Catalog
requests only. It runs once, recorded as a data migration step. Services and
their version snapshots stay in the 2.1.0 SQL.
@akashverma0786
akashverma0786 requested a review from a team as a code owner November 20, 2026 07:36
…ve-databaseschema

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v210/Migration.java
#	openmetadata-service/src/main/java/org/openmetadata/service/migration/postgres/v210/Migration.java
@akashverma0786
akashverma0786 marked this pull request as draft November 20, 2026 07:55
@gitar-bot

gitar-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Removing Unity Catalog’s databaseSchema from the public connection schema and migrating stored records is a breaking interface change; old workflows could fail validation.

Removes the unused databaseSchema field from the Unity Catalog connection, since it never restricted ingestion; schema selection now relies on schemaFilterPattern, and a 2.1.0 migration strips the key from stored services, snapshots, and saved Test Connection requests. No issues found.

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

Comment on lines +44 to +48
IdBatches.fold(
handle,
TABLE,
0,
(sum, batch) -> sum + handle.createUpdate(update).bindList(IDS_BIND, batch).execute());

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.

P1 Test Connection history stops loading

Updating a workflow saves its previous request in entity_extension under workflow.version.*. This migration only repairs automations_workflow, and the new SQL only repairs databaseService.version.*.

After upgrading, reading an affected workflow version or listing its history still sends databaseSchema through UnityCatalogConnectionClassConverter, which rejects the removed field. Repair the workflow snapshots on both databases too, using an indexed lookup.

Knowledge Base Used: Metadata schema contracts

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant