pub fn lineage(
column: &str,
sql: &Expression,
dialect: Option<DialectType>,
trim_selects: bool,
) -> Result<LineageNode>Expand description
Build the lineage graph for a column in a SQL query
§Arguments
column- The column name to trace lineage forsql- The SQL expression (SELECT, UNION, etc.)dialect- Optional dialect for parsingtrim_selects- If true, trim the source SELECT to only include the target column
§Returns
The root lineage node for the specified column
§Example
ⓘ
use polyglot_sql::lineage::lineage;
use polyglot_sql::parse_one;
use polyglot_sql::DialectType;
let sql = "SELECT a, b + 1 AS c FROM t";
let expr = parse_one(sql, DialectType::Generic).unwrap();
let node = lineage("c", &expr, None, false).unwrap();