An asset names a piece of data your Dags share: a table, a file, a model. Asset("daily_sales") is enough; a URI such as postgres://warehouse/analytics/public/daily_sales works too. Two declarations link Dags through it:
- The task that writes the data lists it in
outlets: @task(outlets=[DAILY_SALES]). When that task succeeds, Airflow records an asset event. A failed or skipped task records nothing.
- A Dag that reads the data is scheduled on it:
@dag(schedule=[DAILY_SALES]). Each event queues a run of every consumer that is switched on, and the scheduler starts an asset-triggered run.
The producer does not need to know who reads the table, and nobody guesses when the load will finish. Two Airflow 3 details catch people out: an event that happens while a consumer is paused is not queued for it, so switching it on later does not catch up; and an asset-triggered run has no logical date, so ds and {{ ds }} are not there (the next lessons pass the day in the event).
In Airflow 3.3, the version this workspace models, events that pile up before a consumer starts are handled by one run. Airflow 3.4 changed the default for single-asset and | schedules to one run per event, with a setting to batch them again.
The load declares what it writes; the report runs whenever that table is updated.