dataflow/database
Paul Trowbridge 4cf5be52e8 Rewrite apply_transformations as set-based CTE chain
Replaces the nested FOR loops (row-by-row, rule-by-rule) with a single
SQL CTE chain that processes all records × rules in one pass, mirroring
the TPS approach.

CTE chain:
  qualifying      → all untransformed records for the source
  rx              → apply each rule (extract/replace) to each record
  linked          → LEFT JOIN mappings to find mapped output
  rule_output     → build per-rule JSONB (with retain support)
  record_additions → merge all rule outputs per record in sequence order
  UPDATE          → set transformed = data || additions

Also adds jsonb_concat_obj aggregate (jsonb merge with ORDER BY support)
needed to collapse multiple rule outputs per record into one object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 21:13:49 -04:00
..
functions.sql Rewrite apply_transformations as set-based CTE chain 2026-04-04 21:13:49 -04:00
migrate_input_value_jsonb.sql Add multi-capture regex, computed view fields, collapsible rules, and live preview 2026-03-29 16:37:15 -04:00
migrate_tps.sql Add retain flag to rules for preserving extracted values alongside mappings 2026-04-04 20:48:52 -04:00
schema.sql Add retain flag to rules for preserving extracted values alongside mappings 2026-04-04 20:48:52 -04:00