build_column_trees
xorq.common.utils.lineage_utils.build_column_trees(expr)Build a lineage tree for each column in the expression.
Takes an Ibis table expression and returns a dictionary mapping each column name to a GenericNode that represents the lineage of that column. Use with build_tree or print_tree to visualize column lineage.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| expr | Expr | The table expression to build column lineage trees from. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Dict[str, GenericNode] | Map of column name to lineage tree root for that column. |
Example
import xorq.api as xo
from xorq.common.utils.lineage_utils import build_column_trees, print_tree
con = xo.connect()
t = con.table("my_table")
expr = t.filter(t.a > 0).select("a", "b")
trees = build_column_trees(expr)
for col_name, node in trees.items():
print(f"Column: {col_name}")
print_tree(node)