Repository navigation
Fixes #35319: Add lineage to the Databend connector - #35320
Conversation
❌ 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 |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
1bcbb9f to
eab051a
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
eab051a to
5a2e316
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
5a2e316 to
58224fc
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…tory Add a Databend lineage source that reads table and column lineage recorded by Databend's query planner from system_history.lineage_history instead of parsing SQL. - View lineage comes from CREATE_VIEW records; only the latest definition of a view is used, and overrideViewLineage clears stale upstreams. - Query lineage comes from CTAS and DML records within queryLogDuration. - Only edges whose both endpoints are tables or views of the default catalog are read, matching the catalogs the connector ingests. - Endpoints not yet ingested in OpenMetadata are skipped; columns are kept only when present on both tables. - When lineage_history cannot be read, the workflow reports one failure that explains the missing requirement (history tables, lineage, privileges, license or Databend version). Other workflows are unaffected; the GetLineage test-connection step is optional. - Declare supportsLineageExtraction and regenerate the derived artifacts. Integration tests skip the lineage cases when Databend rejects the license.
58224fc to
a514ebc
Compare
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
@ulixius9 could you add |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 3 closed / 3 findings🔴 High risk · With overrideViewLineage enabled, the Databend source deletes stored view-lineage edges without emitted replacements, which could remove valid lineage relationships. Adds Databend lineage by reading table and column edges from ✅ 3 closed✅ Edge Case: Old view upstreams are reused when the latest CREATE VIEW has no matching rows
✅ Quality: 5-minute replaced-view grace period is an unrecorded judgment call
✅ Edge Case: Stale view lineage kept when all current-definition edges are dropped
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 |
❌ UI Checkstyle Failed❌ Bundle Runtime CheckA route chunk loads but one of its chunks still exports Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
|
|
2a60eab



Describe your changes:
Fixes #35319
Adds lineage to the Databend connector. Databend records table and column lineage from its query planner into
system_history.lineage_history; the new lineage source reads those records directly instead of parsing SQL.Type of change:
High-level design:
databend/lineage.py—DatabendLineageSource(LineageSource), registered aslineage_source_class, so it runs in the standard lineage pipeline.processViewLineage→CREATE_VIEWrecords. Only the latestCREATE VIEWof each view is used; withoverrideViewLineage, stale upstreams are removed through the existingoverride_lineagemechanism.processQueryLineage→CTAS/DMLrecords withinqueryLogDuration.defaultcatalog, matching what the connector ingests. Self-edges from in-place DML are dropped.(source, target); column mappings are unioned and kept only when both columns exist in OpenMetadata; the latest query becomessqlQuery. Endpoints are resolved by FQN (bounded LRU cache); endpoints not yet ingested are skipped and picked up on a later run.schemaFilterPattern/tableFilterPatternapply to both ends.SELECTonsystem_history, license, Databend older than v1.2.933), the lineage workflow reports one failure explaining the missing requirement, mapped from the Databend error code. Metadata, profiler and data quality are unaffected, and the newGetLineagetest-connection step is optional.databendConnection.jsondeclaressupportsLineageExtractionso the UI offers a Lineage ingestion; derived artifacts regenerated. No migration needed (field with a default, no stored data change).query_logdoes not record the current catalog.Tests:
Use cases covered
INSERT ... SELECTwith a cross-database join, two-level CTAS chains and views produce table and column lineage in OpenMetadata.GetLineage) and metadata ingestion keep working.Unit tests
ingestion/tests/unit/source/database/databend/test_lineage.py— runs the real lineage query against an emulatedsystem_history.lineage_history: filters, merging, latest view definition, column filtering, missing endpoints, error hints, single failure per run.Backend integration tests
Ingestion integration tests
ingestion/tests/integration/databend/test_lineage.py— starts Databend with lineage and history tables enabled, runs metadata + lineage workflows and asserts table, column and view lineage in OpenMetadata. Skipped when Databend rejects the Enterprise license.tests/integration/databendlocally: 11 passed.Manual testing performed
[lineage]and[log.history]enabled and created tables with CTAS,INSERT ... SELECT, a cross-database join and views.system_historyprivileges, and Databend v1.2.930.UI screen recording:
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.
For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Decision check: no durable decision beyond this connector's behavior.
The issue properly describes why the new feature is needed, what's the goal, and how we are building it.
I have updated the documentation.
I have added tests around the new logic.