Skip to content

SQL DDL is under-modeled: CREATE TABLE/VIEW become generic Variable nodes with no lineage #574

Closed

Description

@alexisperinger-ux

What problem does this solve?

SQL DDL is under-modeled. CREATE TABLE / CREATE VIEW are extracted but labeled generic Variable, CREATE MATERIALIZED VIEW is dropped, and there is no table-to-table lineage. Every CREATE collapses to an untyped Variable node with zero lineage edges, so the graph cannot answer basic questions:

  • "What tables/views does this view read from?"
  • "What breaks downstream if I change this table?"

Public test bed: lerocha/chinook-database (pure CREATE TABLE / CREATE VIEW DDL).

Proposed solution

  • Label create_table as Table, and create_view / create_materialized_view as View.
  • Emit FROM/JOIN relation references as USAGE lineage edges, resolved through the existing definition registry, so a view links to the tables/views it selects from.
  • Zero schema change: freeform node labels + the existing USAGE edge type. Only relations that resolve against the registry emit an edge, so DML-only files fabricate nothing.

Scope: DDL labeling + FROM/JOIN lineage only.

Alternatives considered

  • A new REFERENCES edge type instead of reusing USAGE: avoided to add no edge type; USAGE already means "X refers to Y".
  • Modeling columns as Field nodes: deferred to keep this small.

Confirmations

  • I searched existing issues and this is not a duplicate.

Activity

  1. DeusData commented on Jun 23, 2026

    @DeusData
    Owner

    Thanks — agreed this is under-modeled today (every CREATE collapsing to an untyped Variable with no lineage). Typing Table / View and emitting FROM/JOIN as USAGE edges through the existing definition registry, with zero schema change and no fabrication for DML-only files, is exactly the right minimal scope.

    This is already implemented in your PR #582, which I'm reviewing — let's continue the discussion there. Labeling enhancement / parsing/quality.

  2. added
    priority/normalStandard review queue; useful PR with ordinary maintainer urgency.
    on Jun 30, 2026
  3. added this to the 0.9.2-rc milestone on Jul 8, 2026
  4. added a commit that references this issue on Aug 20, 2026
    7ba84e3
  5. DeusData commented on Aug 20, 2026

    @DeusData
    Owner

    Fixed on main — landed in #1749, commit 7ba84e3 (merge 4bbc978).

    CREATE TABLE now produces a Table node, CREATE VIEW / CREATE MATERIALIZED VIEW a View node, and a view's FROM/JOIN relations resolve into view -USAGE-> table lineage edges. Schema-qualified DDL (CREATE TABLE app.users) is named by the table identifier rather than the schema prefix, and CREATE PROCEDURE now types as Function. DML-only files still produce no relation nodes — no fabricated lineage, exactly as you scoped it.

    The implementation is distilled from your PR #582 with co-authorship credit; the details of what was added around it are in #1749.

    Thank you for the precise write-up here — the "every CREATE collapses to an untyped Variable" framing is what made the fix obvious, and the accompanying PR made it concrete.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestparsing/qualityGraph extraction bugs, false positives, missing edgespriority/normalStandard review queue; useful PR with ordinary maintainer urgency.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions