Module lineage
Expand description
Shared helper for routing analysis SQL through changes_lineage when
opts.use_canonical_lineage is on. Each path-aggregating analysis calls
materialize_if_needed once at the top of its run_* function, then
wraps its SQL with rewrite (or uses source_table if it builds the
SQL via format!()).
Centralised here so the 12 path-aggregating analyses all share one
dispatch — no per-analysis if opts.use_canonical_lineage ladders to
drift out of sync.
Functions§
- materialize_
if_ needed - Materialise
changes_lineageif the flag is on. Idempotent; safe to call from every analysis. - materialize_
source - Unified source-table materialiser that honours BOTH
--time-bucketAND--use-canonical-lineage. Call this once at the top of an analysis; follow up withsource_tablefor the FROM clause. - rewrite
- Substitute every standalone
FROM changes/JOIN changesinsqlwith the lineage-resolved source table whenopts.use_canonical_lineageis on. - source_
table - Returns the table name to use as the change source for
opts.