Course overview/Practice and extend1 of 4

Correct a source record and rerun a date

Back to course

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_idorder_datetotal_orderspaid_ordersrecognized_revenue
C0022026-01-031142.00
C0042026-01-0311120.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

AI Prompt

Run the source correction exercise from this lesson.

  1. Change only order 1005 from pending to paid in commerce/assets/raw/orders.csv.
  2. Before running anything, state which reporting row and value should change.
  3. Run January 3 twice. Use January 3 as both the start and end date because both dates are included.
  4. 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.

Sign up to our newsletter

Practical updates on open-source data pipelines, AI analysts, governance, and what we are shipping at Bruin.

The signup form is hosted by Brevo. Accept cookies to load it.