feat(sql): first-class Table/View nodes and FROM/JOIN lineage edges#582
Open
alexisperinger-ux wants to merge 4 commits into
Open
feat(sql): first-class Table/View nodes and FROM/JOIN lineage edges#582alexisperinger-ux wants to merge 4 commits into
alexisperinger-ux wants to merge 4 commits into
Conversation
CREATE TABLE/VIEW/MATERIALIZED VIEW now extract as Table/View defs (were generic Variable nodes) and CREATE PROCEDURE as Function. FROM/JOIN relations are emitted as usages scoped to the enclosing CREATE def, so pass_usages resolves them into view->table USAGE lineage edges. The definition-registry allowlist gains Table/View so those defs resolve as edge targets (kept in sync across pass_definitions and pass_parallel). Adds extraction tests for the new labels and the lineage usages. Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com> (cherry picked from commit 63054f04465ec33ffde0b9a23d6f29ce817d96df) Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com>
CREATE TABLE/VIEW now produce Table/View nodes (63054f0) instead of the old Variable mislabel; update the label golden and the probe accordingly. Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com> (cherry picked from commit 7cca3f4faec7d2a12ac1cc6f4e432c8bc286cd94) Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com>
resolve_sql_func_name took the first identifier of object_reference (the schema) for schema.table names; take the last (the table) so CREATE TABLE/VIEW nodes and FROM/JOIN lineage use the real relation name. Adds a schema-qualified regression test. Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com> (cherry picked from commit 877ad51e8c14daf901656d918ced2ef636f7a5b1) Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com>
Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com> (cherry picked from commit 8ffee3834223ce58aa6c26b83c88f2902e07180e) Signed-off-by: alexisperinger-ux <alexis.peringer@iss-stoxx.com>
This was referenced Jun 23, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
SQL DDL was routed through the config-variable path, so
CREATE TABLE/CREATE VIEWbecame genericVariablenodes with no table-to-table lineage: questions like "what does this view read from?" or "what breaks if I drop this table?" were unanswerable from the graph. This makes DDL first-class:create_tablebecomes aTablenode;create_view/create_materialized_viewbecomeViewnodes.USAGElineage edges, resolved against the Table/View registry, so view-to-table lineage is queryable.app.usersresolves asusers).Only relations that resolve against the registry emit an edge, so unresolved names and DML-only files fabricate no nodes or edges.
No schema change: node labels are freeform strings and
USAGEis an existing edge type.Index mode: the new nodes need a full-mode index; fast and moderate prune the directories where DDL typically lives.
Tests:
sql_ddl_node_labels,sql_view_lineage_usages,sql_schema_qualified_nameintests/test_extraction.c.Fixes #574.
Part of the SQL/dbt indexing series
This is one of three PRs that split the SQL + dbt graph-indexing work to keep each under the one-issue-per-PR contributing rule. They share the same extraction and registry plumbing, so they are one logical change reviewed as a set:
Table/Viewnodes + FROM/JOIN lineage (#574)..sql,Model/Macronodes +ref()/source()lineage (#575).Model/Sourcenodes +DEPENDS_ONlineage (#576).