Skip to main content

Module sql_fact_emit

Module sql_fact_emit 

Source
Expand description

Emit SQL table/column-use facts with precision markers.

Walks a populated SqlStatementModel (tables + columns filled by SQLSEM-002 / SQLSEM-003) and emits normalized [Fact]s into a FactStore. Every fact carries a precision marker so the lineage layer can weight the edge:

  • exact — table/column resolved against a single bound alias or single-table scope.
  • expression — column came from a projection expression (function call / arithmetic) rather than a bare reference.
  • unknown — bare column with ambiguous (multi-table) scope or a qualifier that didn’t bind.

The marker is encoded into the DependencyEdge.edge_kind string (ReadsColumn:exact, WritesColumn:unknown, …) so it survives the FACT-001 wire shape without a schema change.

§/oracle evidence

  • DATABASE-REFERENCE.md PL/SQL Language Reference — the table/column reference grammar.
  • LOW-LEVEL-CATALOGS.md Data Dictionary View Families — ALL_TAB_COLUMNS / ALL_DEPENDENCIES are the server-side mirrors; the precision marker records how confident the source-only pass is before that cross-check.

Functions§

emit_sql_use_facts
Emit table-level + column-level use facts for one statement. owner_logical_id is the routine the statement lives in (the from side of every edge). Returns the post-dedup count of facts added.
emit_sql_use_facts_for_model
Emit use facts for every statement in a SqlSemanticModel.