Practice and extend - Step 12 of 15
Correct a source record and rerun a date
Practice correcting one source record, predicting its effect, and rerunning only the affected reporting date.
Practice a focused correction
When a source record changes, rerun only the date it affects when it is safe to do so. This reporting table uses calendar-date ranges, so you can correct one day without reprocessing every day.
Simulate a source correction
Order 1005 was pending when the source file first arrived. Suppose the operational system later marks it paid.
In commerce/assets/raw/orders.csv, change this row:
1005,C002,2026-01-03 10:00:00,pending,42.00
to:
1005,C002,2026-01-03 10:00:00,paid,42.00
Before rerunning, state the expected effect: customer C002 on January 3 should change from 0.00 to 42.00 recognized revenue. No other date in analytics.customer_daily_revenue should change.
Rerun the affected interval
bruin run commerce/pipeline.yml \
--start-date 2026-01-03 \
--end-date 2026-01-03
Inspect the affected rows:
bruin query --connection duckdb-default \
--description "inspect corrected January 3 customer daily revenue" \
--query "SELECT * FROM analytics.customer_daily_revenue WHERE order_date = DATE '2026-01-03' ORDER BY customer_id;"
Expected result:
| customer_id | order_date | total_orders | paid_orders | recognized_revenue |
|---|---|---|---|---|
| C002 | 2026-01-03 | 1 | 1 | 42.00 |
| C004 | 2026-01-03 | 1 | 1 | 120.00 |
Run the same interval a second time:
bruin run commerce/pipeline.yml \
--start-date 2026-01-03 \
--end-date 2026-01-03
The values and row counts should remain unchanged.
Ask your coding agent
Run the source correction exercise from this lesson.
- Change only order
1005frompendingtopaidincommerce/assets/raw/orders.csv. - Before running anything, state which reporting row and value should change.
- Run January 3 twice. Use January 3 as both the start and end date because both dates are included.
- Compare the January 3 rows after each run and confirm no other date changed.
Do not run a full refresh, change another source row, or commit the result. Show the diff, commands, and before-and-after values.
Checkpoint
You have handled a late source correction, predicted its effect, rerun only the affected date, and proved that a second run did not create duplicates.