Holder
LineageHolder is an abstraction to hold the lineage result analyzed by LineageAnalyzer at different level.
At the bottom, we have sqllineage.core.holders.SubQueryLineageHolder
to hold lineage at subquery level.
This is used internally by sqllineage.core.analyzer.LineageAnalyzer
.
LineageAnalyzer generates sqllineage.core.holder.StatementLineageHolder
as the result of lineage at SQL statement level.
To assemble multiple sqllineage.core.holder.StatementLineageHolder
into a DAG based data structure serving
for the final output, we have sqllineage.core.holders.SQLLineageHolder
SubQueryLineageHolder
- class sqllineage.core.holders.SubQueryLineageHolder[source]
SubQuery/Query Level Lineage Result.
SubQueryLineageHolder will hold attributes like read, write, cte.
Each of them is a Set[
sqllineage.core.models.Table
].This is the most atomic representation of lineage result.
- property write_columns: List[Column]
return a list of columns that write table contains. It’s either manually added via add_write_column if specified in DML or automatic added via add_column_lineage after parsing from SELECT
StatementLineageHolder
- class sqllineage.core.holders.StatementLineageHolder[source]
Statement Level Lineage Result.
Based on SubQueryLineageHolder, StatementLineageHolder holds extra attributes like drop and rename
For drop, it is a Set[
sqllineage.core.models.Table
].For rename, it a Set[Tuple[
sqllineage.core.models.Table
,sqllineage.core.models.Table
]], with the first table being original table before renaming and the latter after renaming.
SQLLineageHolder
- class sqllineage.core.holders.SQLLineageHolder(graph: DiGraph)[source]
The combined lineage result in representation of Directed Acyclic Graph.
- Parameters:
graph – the Directed Acyclic Graph holding all the combined lineage result.
- property table_lineage_graph: DiGraph
The table level DiGraph held by SQLLineageHolder
- property column_lineage_graph: DiGraph
The column level DiGraph held by SQLLineageHolder
- property source_tables: Set[Table]
a list of source
sqllineage.core.models.Table
- property target_tables: Set[Table]
a list of target
sqllineage.core.models.Table
- property intermediate_tables: Set[Table]
a list of intermediate
sqllineage.core.models.Table
- static of(metadata_provider, *args: StatementLineageHolder) SQLLineageHolder [source]
To assemble multiple
sqllineage.core.holders.StatementLineageHolder
intosqllineage.core.holders.SQLLineageHolder