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§
- Lineage
Config - Configuration for lineage analysis.
- Lineage
Graph - A lineage graph rooted at a specific output column.
- Lineage
Iterator - Iterator over lineage nodes (pre-order traversal).
- Lineage
Node - A node in the lineage graph representing a column or expression.
Enums§
- Lineage
Error - 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§
- Lineage
Result - Result type for lineage operations.