Repository navigation
fix(unitycatalog): name Databases after the catalog names Unity Catalog stores - #37112
akashverma0786 wants to merge 11 commits into
Conversation
… name Databases as Unity Catalog stores them, never delete after a failed listing - databaseSchema on the connection now restricts the walk to that schema (schemas.get), and the progress totals count only it. - An email owner resolves only by its (lowercased) email; the fallback to a user named after the email's local part assigned assets to a different person. Shared with the Databricks connector. - A configured catalog is ingested under the name catalogs.get returns, so lineage, metric-view lineage and incremental extraction match it for any casing typed; metric-view YAML relations are lowercased before lookup. ADR:2026-11-05-unity-catalog-databases-take-the-name-unity-catalog-stores. - A catalog, schema or table listing that fails partway no longer drives markDeleted* for its scope, and a run that skipped a due cleanup fails with WorkflowFatalError.
❌ PR checklist incompleteThis 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 |
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
|
The Python checkstyle failed. Please run You can install the pre-commit hooks with |
|
…er resolution as on main - The stale-database cleanup now lists the catalogs before it checks for a failed listing. With a configured catalog that listing is the run's only catalog listing, and a failure there used to soft-delete every Database it did not return. - Restore the Databricks owner resolver and its tests to main. Its email local-part fallback was added on purpose in #28466; changing it is out of scope here. - Keep the base "No Database found in the context" guard in the table cleanup, and annotate the mark_schemas/mark_databases overrides. - Test the full-mode table cleanup by the scopes it sends, and make the failed table page test fail on main. - Prune the two G004 baseline entries for the logger calls this branch removed.
…cleanup The progress totals listed the catalogs through the walk's failure-recording listing, so a failed count marked the catalog listing as failed: the database cleanup was skipped and the run failed although the walk saw every catalog. The totals now list the catalogs directly, as the Databricks and Redshift totals do; a failure only costs the denominator, and the progress runner warns and goes on.
… catalog With `databaseSchema` set and `catalog` left blank, the walk asked every catalog for that schema, and a catalog without it counted as a failed listing: its stale cleanup was skipped and every run failed with WorkflowFatalError. - The walk treats a NotFound for the configured schema as "not in this catalog" when no catalog is configured. With a configured catalog, a missing schema is still a recorded failure, and any other error still is too. - Test Connection looked for the schema only in the first listed catalog, so the run could not start when that catalog lacked it. With no configured catalog it now uses the first catalog that has the schema, and fails only when none has it.
…atabase consequence - New record ADR:2026-11-15-unity-catalog-runs-fail-when-a-failed-listing-skipped-their-cleanup states how Unity Catalog applies the REVIEW.md rule, what does not count as a failed listing, and why a listing that fails on every run fails every run. `_iter` cites it instead of the Tableau record, which covers only Tableau's backfill. - The catalog-naming record said the old mixed-case Database goes stale. That holds with markDeletedDatabases off; with it on, the first run soft-deletes it, and a restore is undone by the next run.
…-bugs # Conflicts: # ingestion/src/metadata/ingestion/source/database/unitycatalog/metadata.py # ingestion/tests/unit/topology/database/test_unity_catalog_connection.py
|
Upgrade impact: a failed listing now fails the whole run Skipping stale cleanup for a scope whose listing failed is the right fix. But making the run end with
Some options, roughly from least to most change:
There's also an inconsistency: some failed-listing paths still finish green while skipping cleanup (the re-listing inside |
A failed catalog, schema or table listing still skips the stale cleanup of what it did not reach, but no longer raises WorkflowFatalError. The listing failure is the one recorded error and counts against successThreshold, so a listing that fails on every run (a missing grant) shows as a partial success instead of failing every run. Its message says nothing it missed was deleted and how to clear a recurring failure. Replaces the unmerged 2026-11-15 decision record with ADR:2026-11-19-a-failed-unity-catalog-listing-skips-its-stale-cleanup-without-failing-the-run.
|
@ulixius9 Thanks, went with option 2 in 7174865.
|
Restore the Unity Catalog databaseSchema handling to main: the walk lists every schema again, the progress totals count every filtered schema, and Test Connection checks the configured schema in the resolved catalog only. The catalog-name and failed-listing fixes are unchanged.
| # catalog's schemas, (catalog, schema) for a schema's tables. What such a listing | ||
| # did not reach was not seen, so stale-entity cleanup must leave the scope alone. | ||
| self._incomplete_listings: set[tuple[str, ...]] = set() | ||
| self.owner_resolver = DatabricksOwnerResolver( |
There was a problem hiding this comment.
We don't want to do this. We will tackle soft deletion improvements at a later date in a central manner.
There was a problem hiding this comment.
Thanks @IceS2 for the review, made the required changes.
…s PR Soft-deletion after a failed listing will be handled centrally, as asked in review. This PR now carries only the catalog-name fix.
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findingsNormalizing configured catalog names changes database identity; with markDeletedDatabases enabled, the old mixed-case database and its descendants could be soft-deleted. Unity Catalog Databases are now named after the catalog name ✅ 2 closed✅ Quality: Fail-the-run-on-skipped-cleanup rule for Unity Catalog has no record
✅ Edge Case: Failed schema relisting in table cleanup skips schemas silently
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
IceS2
left a comment
There was a problem hiding this comment.
@akashverma0786, this looks good but it is potentially a breaking change since we will be renaming assets from every person using this, right?
Shouldn't we have a migration for this? @ulixius9 if you could also check this out



Describe your changes:
No linked issue: this bug comes from a live audit of the Unity Catalog connector against a Databricks workspace (OpenMetadata
2.1.0,0d18bb8e0a2). It was reproduced with real ingestion on two fresh services, with a control that passed in the same runs, and the fix was verified the same way. The connector code is identical onmainand2.1, so it is present on both.A catalog configured in mixed case loses all lineage.
catalog: Demobecame DatabaseDemo. The system tables reportdemo, and lineage buildssvc.demo…and looks it up by exact name, so every target missed. Live:emitted 0 edges over 15 targetsand 0 edges, while the run reported 100 % success. Metric-view lineage warned that every source was "not in OpenMetadata".QA_UC_CaseChkstoresqa_uc_casechk, the second spelling fails withSCHEMA_ALREADY_EXISTS, andcatalogs.get('DEMO').nameisdemo.catalogs.get()returns (lowercased text only if that call fails). Text the connector parses, a metric view's YAMLsource, is lowercased before lookup. New record:ADR:2026-11-05-unity-catalog-databases-take-the-name-unity-catalog-stores.Behavior change to note in the release:
cataloggets a second, lowercase Database on its next run. WithmarkDeletedDatabasesoff (the default), the old one keeps its curated metadata and goes stale until it is deleted. With it on, that run soft-deletes the old Database and everything under it; restoring it brings the curated metadata back, but the next such run deletes it again. No migration renames it: the server cannot rename a Database today (renameAllowedis off).Type of change:
High-level design:
unitycatalog/metadata.pyandunitycatalog/metric_view_lineage.py, with no schema, server or UI change.catalogs.get), never from the typed text.cached_property, so the progress totals and the walk agree.CatalogInfoit fetched is reused byyield_database, as before.Tests:
Use cases covered
catalog: Demo/DEMO: Databasedemo, onecatalogs.getshared by totals and walk; unreadable catalog falls back to lowercase; metric-view YAML relations in capitals resolve; an inherited scope is kept as ingested.Unit tests
mainand pass on this branch.tests/unit/topology/database/test_unitycatalog_configured_scope.py;tests/unit/topology/database/test_unitycatalog_metric_view_lineage.py.test_unitycatalog*unit test files,225 passed; and every unit test file that mentions Unity Catalog or Databricks (67 files),1406 passed. The 2 failures and 8 collection errors are all optional drivers missing from the local venv (sqlalchemy_exasol,teradatasqlalchemy,looker_sdk,mlflow,pyhive,snowflake,trino,validators).test_unitycatalog*files):unitycatalog/metadata.py82 %,unitycatalog/metric_view_lineage.py94 %.ruff check/ruff format --checkclean;scripts/check_ruff_suppressions.py --checkpasses;basedpyright --baselinefile .basedpyright/baseline.json --baselinemode=discardon the two source files: 0 errors.Backend integration tests
Ingestion integration tests
tests/integration/suite for Unity Catalog or Databricks. Real ingestion runs against a live workspace are listed below instead.Playwright (UI) tests
Manual testing performed
Real
MetadataWorkflowand lineage workflow runs from a CLI venv against a live Databricks workspace (SQL warehouse, PAT) and a local OpenMetadata 2.1 server, each on fresh services. Before = original code, after = this change. The catalog-name code in this PR is the same code these runs used.catalog: Demoandcatalog: DEMO, metadata + lineage. Before (2): DatabaseDemo/DEMO,emitted 0 edges over 15 targets. After (2): Databasedemo, 15 edges, identical to the lowercase-democontrol.mv_capswithsource: DEMO.QA_UC_A.ORDERS. Before (2):source relation [DEMO.QA_UC_A.ORDERS] is not in OpenMetadata, no edge. After (2): edgedemo.qa_uc_a.orders → demo.qa_uc_mvcase.mv_capswith column lineage (amount → total_amount,status → order_status), no warning.UI screen recording:
Not applicable — ingestion-only bug fix, no UI change.
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>— no issue: found by a live connector audit, details above.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: not applicable, no schema change.
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 diff against
REVIEW.mdand fixed every 🔴 finding.7174865021d. The final diff only removes the failed-listing change from it; the catalog-name code is unchanged.Decision check: adds
docs/decisions/2026-11-05-unity-catalog-databases-take-the-name-unity-catalog-stores.md.I have added a test that covers the exact scenario we are fixing.


Confidence Score: 5/5
The PR appears safe to merge with the documented upgrade behavior.Summary
Unity Catalog databases now use the catalog name returned by its API. Metric-view lineage lowercases relation names written in YAML while preserving inherited database and schema names.
Reviews (11) · Last reviewed commit: "fix(unitycatalog): leave the failed-list..." · Reviewed by Greptile