Skip to main content

Module lineage

Module lineage 

Source
Expand description

Column Lineage Tracking

This module provides functionality to track column lineage through SQL queries, building a graph of how columns flow from source tables to the result set. Supports UNION/INTERSECT/EXCEPT, CTEs, derived tables, subqueries, and star expansion.

Structs§

LineageNode
A node in the column lineage graph
LineageWalker
Iterator for walking the lineage graph
QueryOutput
The ordered output description of a query.
SetBranch
Metadata describing a lineage node’s position in an immediate set operation.

Enums§

OutputColumn
One entry in a query’s ordered output description.
SetOperator
The set operator that owns an immediate lineage branch.

Functions§

collect_source_tables
Recursively collect source table names from lineage graph
expand_cte_stars
Expand SELECT * in CTEs by walking CTE definitions in order and propagating resolved column lists. This handles nested CTEs (e.g., cte2 AS (SELECT * FROM cte1)) which qualify_columns cannot resolve because it processes each SELECT independently.
get_source_tables
Get all source tables from a lineage graph
lineage
Build the lineage graph for a column in a SQL query
lineage_at
Build the lineage graph for the column at a zero-based output ordinal.
lineage_at_with_schema
Build schema-aware lineage for the column at a zero-based output ordinal.
lineage_with_schema
Build the lineage graph for a column in a SQL query using optional schema metadata.
output_columns
Return the ordered output description of a query.
output_columns_with_schema
Return the ordered output description of a query after schema-aware expansion.