Before this: Rules you can run twice
The idea
Results change between runs when a step depends on something other than the input: the current date, random sampling, the order rows happened to arrive in, or an unordered survivor rule.
Pass the reporting date as a parameter, sort with a unique final key, and avoid random choices in cleaning.
Test it: run twice and compare outputs byte for byte.
Worked example
Input: WHERE order_date > current_date - 30
- Visual
Add step → Filter rows → order_date after the reporting date parameter
- SQL (DuckDB)
WHERE order_date > DATE '2026-11-01' - INTERVAL 30 DAY -- reporting date passed in
- pandas
df[df["order_date"] > report_date - pd.Timedelta(days=30)]
Result: Rerunning last month's report gives last month's numbers
Common mistakes
- Reading the clock inside the pipeline.
- Unordered deduplication.
- Random tie-breaks.
Check yourself
How do you test determinism?
Run the pipeline twice on the same input and compare the outputs.
Practice it
Deduplicate order lines at the right grain with a deterministic rule.