Skip to content

Change data capture

m4bwav edited this page Dec 4, 2026 · 1 revision

Change data capture

Compare two dated snapshots by a key and process only what changed.

python skills/datawright/scripts/dw.py diff 2026-12-01.csv 2026-12-04.json --key id

Input may be CSV or JSON (a list of objects). Output counts new, dropped, changed and unchanged rows; --json prints the rows themselves.

Option Meaning
--key id column that identifies a row (required)
--fields price,owner compare only these columns
--move 0.10 a numeric change under 10% counts as unchanged
--json machine-readable output

Exit codes: 0 no changes, 1 changes, 2 bad input, so a pipeline can skip work on 0.

Numbers compare by value: 101 and 101.0 are the same. With fewer than 30 rows on either side the output adds a thin: line, because the counts are not a trend.

Prove it: run the diff on the same snapshot twice (expect 0 changes), then plant one change and expect exactly one.

Clone this wiki locally