A Dag can depend on more than one asset:
- A list waits for all of them:
schedule=[DAILY_SALES, DAILY_REFUNDS] runs once both have been updated since its last run.
& says the same thing as an expression: schedule=(DAILY_SALES & DAILY_REFUNDS).
| runs when any of them is updated: schedule=(DAILY_SALES | DAILY_REFUNDS).
- They nest:
DAILY_SALES & (DAILY_REFUNDS | STORE_CLOSURES).
With &, an asset updated twice before the other one arrives still gives one run, and that run sees both events. Wrap expressions in brackets so the operators group the way you mean.
To run on a clock and on data, use AssetOrTimeSchedule from airflow.timetables.assets:
schedule=AssetOrTimeSchedule(
timetable=CronTriggerTimetable("0 7 * * *", timezone="UTC"),
assets=[SALES_CORRECTIONS],
)
It creates the scheduled runs and, separately, an asset-triggered run whenever the assets update.
Finance runs once both tables have been loaded.