Schedules¶
Configure when and how often your dbt models run.
Supported Schedule Tags¶
dmp-af supports the following schedule tags:
@monthly
¶
Runs once a month on the first day at midnight.
- Cron:
0 0 1 * *
- Use Case: Monthly reports, aggregations
@weekly
¶
Runs once a week on Sunday at midnight.
- Cron:
0 0 * * 0
- Use Case: Weekly summaries, reports
@daily
¶
Runs once a day at midnight.
- Cron:
0 0 * * *
- Use Case: Daily models, most common schedule
@hourly
¶
Runs every hour at the beginning of the hour.
- Cron:
0 * * * *
- Use Case: Near real-time updates, frequent refreshes
@every15minutes
¶
Runs every 15 minutes.
- Cron:
*/15 * * * *
- Use Case: Very frequent updates, real-time dashboards
@manual
¶
No automatic schedule - run manually only.
- Use Case: Backfills, one-off runs, triggered by other DAGs
See Manual Scheduling Tutorial for details.
Schedule Shifts¶
Offset your schedule by a specified amount using schedule_shift
and schedule_shift_unit
.
Configuration¶
models:
- name: delayed_model
config:
schedule: "@daily"
schedule_shift: 2
schedule_shift_unit: "hour"
This model runs daily, but 2 hours after midnight (02:00 instead of 00:00).
Supported Units¶
minute
hour
day
week
DAG Naming¶
Shifted schedules create separate DAGs:
Example: sales_daily_shift_2_hours
Use Cases¶
- Dependency delays: Wait for upstream data
- Resource distribution: Spread load across time
- Timezone adjustments: Align with business hours
Examples¶
Multiple Schedules per Domain¶
models:
- name: hourly_events
config:
schedule: "@hourly"
- name: daily_summary
config:
schedule: "@daily"
- name: weekly_report
config:
schedule: "@weekly"
This creates three DAGs:
domain_hourly
domain_daily
domain_weekly
Shifted Schedule¶
models:
- name: after_hours_model
config:
schedule: "@daily"
schedule_shift: 18
schedule_shift_unit: "hour"
Runs at 18:00 (6 PM) instead of midnight.
Coordinating Dependencies¶
# Runs at midnight
models:
- name: source_model
config:
schedule: "@daily"
# Runs at 01:00, after source_model
- name: derived_model
config:
schedule: "@daily"
schedule_shift: 1
schedule_shift_unit: "hour"
dependencies:
source_model:
wait_policy: last
Best Practices¶
Choose Appropriate Frequency¶
- @every15minutes: Only for models that truly need real-time data
- @hourly: For frequently changing data
- @daily: Default for most analytical workloads
- @weekly/@monthly: For summary and reporting tables
Consider Resource Usage¶
More frequent schedules mean:
- Higher compute costs
- More database load
- More Airflow task slots used
Use Schedule Shifts¶
Instead of creating custom cron schedules, use shifts:
# Good
schedule: "@daily"
schedule_shift: 6
schedule_shift_unit: "hour"
# Avoid custom cron (not supported)
schedule: "0 6 * * *" # This won't work!
Group by Schedule¶
Models with the same schedule in the same domain run in one DAG:
models:
- name: model_a
config:
schedule: "@daily"
- name: model_b
config:
schedule: "@daily" # Same DAG as model_a
- name: model_c
config:
schedule: "@hourly" # Different DAG
Troubleshooting¶
Model Not Running on Schedule¶
- Check DAG is enabled in Airflow UI
- Verify schedule tag spelling
- Check Airflow scheduler is running
- Review DAG catchup settings
Wrong Schedule Time¶
- Verify timezone in Airflow configuration
- Check
schedule_shift
settings - Review
domain_start_date
Too Many DAGs Created¶
Each combination of domain + schedule creates a DAG. Consider:
- Consolidating schedules
- Using schedule shifts instead of different schedules
- Grouping models by domain
Related Topics¶
- Dependencies - Managing cross-schedule dependencies
- Manual Scheduling Tutorial - Using @manual
- Model Configuration - All model config options