pipekit/config/modules/ocrs.sql
Paul Trowbridge dd9f89f4b5 feat: version-control pipeline definitions via export/apply
Add `pipekit export` / `pipekit apply` (pipekit/config_io.py) to serialise the
DB's config — drivers, connections, modules (+ columns, watermarks, hooks),
groups, schedules — to a git-trackable text tree under config/, and rehydrate
it. SQLite stays runtime state; definitions become diffable/reviewable/
revertible.

- config only: run_log/group_run/settings and per-run state columns excluded
- name-keyed refs (portable across databases); source_query in .sql sidecars;
  columns as real JSON arrays for line-by-line diffs
- newline-normalised so CRLF-vs-LF is never a spurious change
- apply is create/update by name; child collections fully synced; top-level
  deletes gated behind --prune; --dry-run prints the plan
- round-trip is identity (export -> apply --dry-run == nothing to do)

Commits the current config/ as the first baseline, capturing the freshly
populated columns_json for rm00101/rm00301/iv00101. Documented in SPEC.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 10:56:55 -04:00

24 lines
721 B
SQL

WITH changed AS (
SELECT dcord# FROM lgdat.ocrh WHERE dcudat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
UNION SELECT dcord# FROM lgdat.ocrh WHERE dcodat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
UNION SELECT dcord# FROM lgdat.ocrh WHERE dccdat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
)
SELECT
"FFORD#" AS "fford#",
"FFITM#" AS "ffitm#",
"FFDIS#" AS "ffdis#",
RTRIM(FFDISC) AS ffdisc,
RTRIM(FFDDES) AS ffddes,
RTRIM(FFDRCR) AS ffdrcr,
RTRIM(FFBANT) AS ffbant,
FFPERC AS ffperc,
FFDAMT AS ffdamt,
RTRIM(FFAPER) AS ffaper,
FFDEXT AS ffdext,
RTRIM(FFAUNT) AS ffaunt,
RTRIM(FFRTEF) AS ffrtef,
FFRNDD AS ffrndd,
RTRIM(FFAPLY) AS ffaply
FROM LGDAT.OCRS
WHERE "FFORD#" IN (SELECT dcord# FROM changed)