Skip to content

Fix create_delta_data_intervals being ignored for timedelta schedules - #69869

Open
sharetheknowledge wants to merge 11 commits into
apache:mainfrom
sharetheknowledge:fix/create-delta-data-intervals-config
Open

Fix create_delta_data_intervals being ignored for timedelta schedules#69869
sharetheknowledge wants to merge 11 commits into
apache:mainfrom
sharetheknowledge:fix/create-delta-data-intervals-config

Conversation

@sharetheknowledge

@sharetheknowledge sharetheknowledge commented Jul 14, 2026

Copy link
Copy Markdown

Fixes a bug where create_delta_data_intervals had no effect on DAGs with a
timedelta/relativedelta schedule.

_create_timetable() in task-sdk/src/airflow/sdk/definitions/dag.py checked
create_cron_data_intervals for both the cron-string branch and the
timedelta/relativedelta branch. As a result:

  • create_delta_data_intervals had no effect at all - it's referenced nowhere
    else in the codebase besides CLI config-list metadata and docs.
  • create_cron_data_intervals silently controlled timetable selection for
    timedelta/relativedelta schedules too, which isn't what it's documented
    to do (config.yml describes it as governing only cron-string schedules).

The timedelta | relativedelta branch now checks create_delta_data_intervals
instead, matching config.yml's documented behavior and making the two config
keys independent, as intended.

Tests

test_timedelta_schedule_respects_create_delta_data_intervals_config in
task-sdk/tests/task_sdk/definitions/test_dag.py is parametrized over
(delta, cron, expected) and over the schedule type:

  • both False (the shipped default) -> DeltaTriggerTimetable
  • create_delta_data_intervals=True -> DeltaDataIntervalTimetable
  • create_cron_data_intervals=True alone -> still DeltaTriggerTimetable
    (regression guard against the exact bug fixed here)

each run against timedelta(days=1) and relativedelta(days=1), for six
independent cases.

Verified locally: all six pass against the fix, and four of the six fail
against the pre-fix code (both delta-true rows and both cron-true rows,
including the relativedelta ones). Full test_dag.py suite: 99 passed.

Note: unit_tests.cfg sets both create_cron_data_intervals and
create_delta_data_intervals to true, which is why the existing test suite
never caught this - both keys being true produced the same (accidentally
correct) result before and after this fix for any test not overriding them
individually.

Docs and newsfragment

The fix changes behavior for anyone who set create_cron_data_intervals = True
on the upgrade guide's advice, so this PR documents it in four places:

  • airflow-core/newsfragments/69869.significant.rst - who is affected and the
    remedy.
  • upgrading_to_airflow3.rst - a bullet next to the existing
    create_cron_data_intervals one.
  • timetable.rst - create_delta_data_intervals added to "Switching between
    trigger and data interval timetables".
  • config.yml - the skip-one-period paragraph the cron entry already had but
    the delta entry lacked.

Setting create_delta_data_intervals = True is a no-op before this fix, so it
can be set ahead of upgrading to keep current behavior.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code following the guidelines

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments.

_create_timetable() checked create_cron_data_intervals for both the
cron-string branch and the timedelta/relativedelta branch, so
create_delta_data_intervals had no effect and DAGs with a timedelta
schedule silently followed the cron config instead.

Closes apache#69868
@boring-cyborg

boring-cyborg Bot commented Jul 14, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 18, 2026
Comment thread task-sdk/src/airflow/sdk/definitions/dag.py
Comment thread task-sdk/tests/task_sdk/definitions/test_dag.py Outdated
Comment thread task-sdk/tests/task_sdk/definitions/test_dag.py Outdated
Per kaxil review: sibling files (test_connection.py, test_variables.py,
test_operator_resources.py) all import conf_vars at module level. No circular-import
reason for it to live in the function body.
Per kaxil review: convert the three inline conf_vars blocks to a single
@pytest.mark.parametrize test. Stack a schedule parametrize to also cover
relativedelta, giving 6 test cases (3 config combos x timedelta/relativedelta).
Hoist DeltaDataIntervalTimetable, DeltaTriggerTimetable, and relativedelta
to module level (required for parametrize decorator to reference them).
ruff check --select I flagged I001. Sort pytest before dateutil in the
third-party block, and definitions.param before definitions.timetables.*
in the first-party block.
The new create_delta_data_intervals bullet makes three items in the list,
but the lead-in sentence still said two.
@sharetheknowledge

Copy link
Copy Markdown
Author

All three review comments are addressed:

  • Newsfragment plus the three doc locations (upgrading_to_airflow3.rst,
    timetable.rst, config.yml)
  • conf_vars hoisted to module level
  • The test is parametrized over (delta, cron, expected) and over the schedule
    type, so the three config combinations each run against timedelta and
    relativedelta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:task-sdk ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create_delta_data_intervals is never read - timedelta/relativedelta schedules check create_cron_data_intervals instead

3 participants