Skip to content
Bronze 5 min read · Schedules 2 practice problems ↓

Schedules and logical dates

"Run every night at 2 am" sounds simple, but Airflow attaches dates to every run in a way that surprises almost everyone at first. This lesson shows how a schedule becomes runs, and the three dates each run carries.

Pipelines in production · Airflow · Bronze · Schedules, lesson 1 of 2

Read first: A DAG file, line by line (skip if you know it)

In plain words first

A newspaper printed at 2 am on Tuesday is about Monday. The printing time and the day it covers are different dates, and the paper is labelled with the day it covers.

Airflow runs work the same way: a nightly run that starts on Tuesday usually processes Monday's data, and each run knows both dates.

schedule= becomes a timetable

schedule=Timetable in Airflow 3Runs
"0 2 * * *", "@daily", "@hourly"CronTriggerTimetableAt each cron time
timedelta(hours=6)DeltaTriggerTimetableEvery 6 hours
"@once"OnceTimetableOnce, at the start date
NoneNullTimetableOnly when triggered by hand or by the API
An assetasset: Airflow 3's name for a piece of data a task updates. Other DAGs can be scheduled to run when it changes. Learn more →, or a list of assetsAsset-triggeredWhen upstream DAGsDAG: A pipeline in Airflow: a set of tasks and the order they run in, defined in a Python file and run on a schedule. Learn more → update the data

Three dates every run has

  • run_after: when the run may start, the moment the schedule fires.
  • logical_date: the date the run is "for", the one {{ ds }} formats. Two runs of a DAG never share it.
  • data interval (data_interval_start, data_interval_end): the period of data the run covers.

With the Airflow 3 default, CronTriggerTimetable, a run is a point in time: logical date, data interval start and end, and run_after are all the moment the schedule fires. The run at 02:00 on 3 March has ds = 2026-03-03.

Python · dags/listeners_daily.py · Airflow 3 default: the run is for the moment it fires
import pendulum
from airflow.sdk import DAG
from airflow.providers.standard.operators.bash import BashOperator

with DAG(
    dag_id="listeners_daily",
    schedule="0 2 * * *",
    start_date=pendulum.datetime(2026, 3, 1, tz="UTC"),
    catchup=True,
):
    count = BashOperator(
        task_id="count_listeners",
        bash_command="count_listeners --day {{ ds }} --until {{ data_interval_end }}",
    )

What the schedulerscheduler: The Airflow process that reads DAG files, creates runs when they are due, and queues the tasks whose upstream tasks are done. Learn more → does · deployed Mar 1, 00:00 UTC · grid as of Mar 3, 03:00 UTC · 0 2 * * * (CronTriggerTimetable)

task \ runMar 1
02:00
Mar 2
02:00
Mar 3
02:00
count_listeners

success· the bar on top is the run's state; a number is how many tries

Command of count_listeners, run by run

Mar 1, 02:00  count_listeners --day 2026-03-01 --until 2026-03-01 02:00:00+00:00
Mar 2, 02:00  count_listeners --day 2026-03-02 --until 2026-03-02 02:00:00+00:00
Mar 3, 02:00  count_listeners --day 2026-03-03 --until 2026-03-03 02:00:00+00:00

What changed from Airflow 2

Airflow 2 turned a cron schedule into a CronDataIntervalTimetable: the run at 02:00 on 3 March covered the interval from 2 March 02:00 to 3 March 02:00, and its logical date was the start of that interval, 2 March. "The run for the 2nd happens on the 3rd" confused generations of engineers, and Airflow 3 dropped it as the default. A DAG migrated unchanged now processes a different day: {{ ds }} moves forward by one schedule. Ask for the old behaviour explicitly when the pipeline really processes complete periods:

Python · dags/listeners_daily_v2.py · Airflow 2 behaviour, by choice: the run covers the previous day
import pendulum
from airflow.sdk import DAG
from airflow.providers.standard.operators.bash import BashOperator
from airflow.timetables.interval import CronDataIntervalTimetable

with DAG(
    dag_id="listeners_daily_v2",
    schedule=CronDataIntervalTimetable("0 2 * * *", timezone="UTC"),
    start_date=pendulum.datetime(2026, 3, 1, tz="UTC"),
    catchup=True,
):
    count = BashOperator(
        task_id="count_listeners",
        bash_command="count_listeners --day {{ ds }} --until {{ data_interval_end }}",
    )

What the scheduler does · deployed Mar 1, 00:00 UTC · grid as of Mar 3, 03:00 UTC · 0 2 * * * (CronDataIntervalTimetable)

task \ runMar 2
02:00
Mar 3
02:00
count_listeners

success· the bar on top is the run's state; a number is how many tries

Command of count_listeners, run by run

Mar 2, 02:00  count_listeners --day 2026-03-01 --until 2026-03-02 02:00:00+00:00
Mar 3, 02:00  count_listeners --day 2026-03-02 --until 2026-03-03 02:00:00+00:00

Compare the two grids: with data intervals, the first run waits until its interval has ended (2 March 02:00) and is for 1 March. Same cron string, different runs and different dates in every command.

Tip: write the date you mean. For "yesterday's data" under the default timetable, compute it from the run: {{ macros.ds_add(ds, -1) }}. For "the interval this run covers", use a data-interval timetable and {{ data_interval_start }}. Both are explicit; relying on what ds happened to mean in Airflow 2 is not.

Time zones

Give start_date a time zone (pendulum.datetime(..., tz="Asia/Kolkata")) and cron schedules follow that zone's wall clock, including daylight-saving changes. A naive datetime is read in the deployment's default time zone, UTC unless configured. Pick one deliberately; the examples here use UTC.

Common mistakes

  • Migrating a DAG to Airflow 3 without checking ds — Cron DAGs now process the day the run fires, not the day before.
  • Assuming a run at 02:00 covers "today" — It covers whatever your commands say: make the date explicit.
  • A naive start_date — The schedule follows the default time zone, which may not be yours.
  • schedule_interval= — Removed in Airflow 3: use schedule=.

Key takeaways

  • A cron schedule is a CronTriggerTimetable in Airflow 3: logical date = when the run fires.
  • Airflow 2 used data intervals: the run for a period happened after it, dated by its start.
  • CronDataIntervalTimetable brings that behaviour back when you need it.
  • Say the date you mean in templates; give start_date a time zone.

Interview prep

THE QUESTION

"In Airflow 3, a DAG runs daily at 02:00. Which date is {{ ds }} in the run on 3 March, and how was it different in Airflow 2?"

In Airflow 3 the default CronTriggerTimetable makes the logical date the moment the run fires, so ds is 2026-03-03, and the data interval is just that point. In Airflow 2 a cron schedule meant a CronDataIntervalTimetable: the 3 March 02:00 run covered 2 March 02:00 to 3 March 02:00 and its logical date was the interval start, so ds was 2026-03-02. Migrated DAGs therefore shift by one day unless they use CronDataIntervalTimetable explicitly or compute the date they want, such as macros.ds_add(ds, -1).

Avoid: "ds is the day before the run" without the version. That was Airflow 2's data-interval default; in Airflow 3 a cron schedule dates a run by when it fires.

Follow-ups · answer out loud, then open

Follow-up"When would you still use CronDataIntervalTimetable in Airflow 3?"
When each run processes a complete period, such as yesterday's data in a run that fires after midnight, and you want data_interval_start and data_interval_end to describe that period. It also keeps migrated Airflow 2 DAGs processing the same dates.
Scenario"A DAG scheduled at 01:30 in Europe/Berlin ran twice on one day and not at all on another. Why?"
Daylight saving time. In a zone that changes clocks, some local times happen twice or not at all on the change days. Schedule outside the change window (after 03:00), or schedule in UTC and accept that the local time moves.
Trap"schedule=timedelta(days=1) and schedule='@daily' are the same."
A cron preset is aligned to the clock: midnight every day. A timedelta schedule counts from the start date: every 24 hours from whenever that is. They match only if the start date is midnight.

Check yourself

3 questions

schedule="0 2 * * *" in Airflow 3. What is ds for the run that fires on 3 March at 02:00?

Show the answer

2026-03-03. CronTriggerTimetable dates a run by the moment it fires.

With CronDataIntervalTimetable("0 2 * * *"), when does the run for 1 March fire?

Show the answer

2 March 02:00. The run covers 1 March 02:00 to 2 March 02:00 and fires when that interval ends.

What does schedule=None mean?

Show the answer

Only manual or API-triggered runs. NullTimetable: the scheduler never creates runs by itself.

Practise this

Problems that use this, graded on hidden tests

Keep going

Up next · Schedules · lesson 2 of 2 · 5 min read
Catchup, backfill and end_date
Which runs a late deploy creates, filling history on purpose, and limiting runs in flight.

Related lessons

Previous: Running Airflow 3 on your laptop

Primary sources: Timetables · Cron and time intervals · Upgrading to Airflow 3