Skip to main content

Module lineage

Module lineage 

Source
Expand description

Column lineage tracking for SQL queries.

Provides functionality to trace data flow from source columns through query transformations to output columns. This is the foundation for data governance tools and impact analysis.

Inspired by Python sqlglot’s lineage.py.

§Example

use sqlglot_rust::parser::parse;
use sqlglot_rust::dialects::Dialect;
use sqlglot_rust::optimizer::lineage::{lineage, LineageConfig};
use sqlglot_rust::schema::MappingSchema;

let sql = "SELECT a, b + 1 AS c FROM t";
let ast = parse(sql, Dialect::Ansi).unwrap();
let schema = MappingSchema::new(Dialect::Ansi);
let config = LineageConfig::default();

let graph = lineage("c", &ast, &schema, &config).unwrap();
assert_eq!(graph.node.name, "c");

Structs§

LineageConfig
Configuration for lineage analysis.
LineageGraph
A lineage graph rooted at a specific output column.
LineageIterator
Iterator over lineage nodes (pre-order traversal).
LineageNode
A node in the lineage graph representing a column or expression.

Enums§

LineageError
Errors specific to lineage operations.

Functions§

lineage
Build lineage for a specific output column in a SQL statement.
lineage_sql
Build lineage from a SQL string.

Type Aliases§

LineageResult
Result type for lineage operations.