Skip to main content

Module lineage

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_lineage if the flag is on. Idempotent; safe to call from every analysis.
materialize_source
Unified source-table materialiser that honours BOTH --time-bucket AND --use-canonical-lineage. Call this once at the top of an analysis; follow up with source_table for the FROM clause.
rewrite
Substitute every standalone FROM changes / JOIN changes in sql with the lineage-resolved source table when opts.use_canonical_lineage is on.
source_table
Returns the table name to use as the change source for opts.