Repository navigation
How should I handle corrections to older data in a daily Airflow DAG? #77749
|
I’m designing a daily DAG that downloads a public collision dataset and writes one partition per day. The source can revise records from previous days. If Tuesday’s download includes a correction to Friday’s data, would you reprocess a rolling window in each scheduled run, or trigger a separate backfill for Friday? I’d like reruns to update the affected partitions without creating duplicates. |
Replies: 1 comment
|
I’d use a rolling window if corrections usually arrive within a predictable number of days. If the source tells you which older dates changed, reprocess just those partitions. For a one-off correction to Friday outside the window, use a targeted backfill. To make retries safe, replace the affected partition when you have a complete snapshot for that day. If the source only sends changed rows, upsert by a stable collision ID so rerunning the task doesn’t create duplicates. Look at this docsmentation https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/backfill.html |
I’d use a rolling window if corrections usually arrive within a predictable number of days. If the source tells you which older dates changed, reprocess just those partitions. For a one-off correction to Friday outside the window, use a targeted backfill. To make retries safe, replace the affected partition when you have a complete snapshot for that day. If the source only sends changed rows, upsert by a stable collision ID so rerunning the task doesn’t create duplicates. Look at this docsmentation https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/backfill.html