pub struct TableLineageEdge {
pub source: TableRead,
pub target: TableWrite,
}Expand description
A source-to-target table lineage edge inferred from the statement structure.
Emitted only for statements that physically move data into a target
(INSERT, UPDATE, MERGE, CREATE TABLE AS SELECT, CREATE VIEW).
DELETE, DROP, TRUNCATE, ALTER, and bare SELECT produce no
lineage even when they reference other tables — the touched tables are
still visible through TableOperation::reads and
TableOperation::writes.
Each TableLineageEdge is a single directed edge — a statement that derives
t from a JOIN b emits two edges (a → t, b → t), not one entry
with both sources.
Occurrence on the source side: a statement reading the same real
table twice (FROM s AS x JOIN s AS y, repeated FROM s across UNION
branches) emits one edge per occurrence. A CTE body — the one
declaration shared by every CteRef — contributes once instead (it
materializes once and feeds once), matching how reads walks the body
at its declaration rather than at each reference. Consumers wanting
set-union semantics dedup explicitly via HashSet::from_iter. Matches
ColumnLineageEdge on the
non-CTE multiplicity rule.
Tables referenced only inside a predicate subquery are excluded:
INSERT INTO t SELECT FROM s WHERE id IN (SELECT id FROM x) emits
s → t but not x → t. x remains visible via reads.
CTE transitivity: WITH cte AS (SELECT ... FROM s) INSERT INTO t SELECT ... FROM cte emits s → t because s sits in a
data-feeding chain from the CTE body up through the INSERT target.
An unreferenced CTE contributes nothing — WITH cte AS (SELECT a FROM s) INSERT INTO t SELECT 1 emits no edge (the cte is bound
but never FROM-used, so s doesn’t feed t).
Recursive CTEs collapse the same way: the anchor branch’s real tables feed the target, and the self-reference terminates against the pre-bind stub without re-emitting the cycle.
Fields§
§source: TableReadThe feeding source table, paired with its catalog-match
ResolutionKind.
target: TableWriteThe write target, paired with its catalog-match
ResolutionKind — the write-side counterpart
of source (TableWrite).
Trait Implementations§
Source§impl Clone for TableLineageEdge
impl Clone for TableLineageEdge
Source§fn clone(&self) -> TableLineageEdge
fn clone(&self) -> TableLineageEdge
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TableLineageEdge
impl Debug for TableLineageEdge
impl Eq for TableLineageEdge
Source§impl Hash for TableLineageEdge
impl Hash for TableLineageEdge
Source§impl PartialEq for TableLineageEdge
impl PartialEq for TableLineageEdge
Source§fn eq(&self, other: &TableLineageEdge) -> bool
fn eq(&self, other: &TableLineageEdge) -> bool
self and other values to be equal, and is used by ==.