DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
Status
With the changes proposed in AIP-103, the scope of this AIP is changing. Rather than needing to implement a state management system, the tools that AIP-103 will produced will be used. This AIP will aim to shift the paradigm of "Asset watching" to be Asset-aware, something that BaseEventTrigger are not currently. In order for the model developed in AIP-103 to be leveraged for Asset watching (with BaseEventTriggers), this pattern must be implemented. This AIP will also introduce a more intuitive manner for authoring tools for "Asset watching"
Motivation
Incremental processing is one of the most, it not the most common pattern implement with Airflow. Although external event driven scheduling is supported today in Airflow via AIP-82, incremental polling is not something that has been easy to implement. In more traditional DAG authoring (Sensors, Operators, etc.), users are forced to use XCom or Variables for storing values (watermarks) for incremental processing, or inventing their own solution. In the case of event-driven triggering, it’s even more challenging for users to build their custom incremental processing implementation, due to the lack of XCom support and limitations of Variable s.
There have been several attempts to store state within a child of the BaseEventTrigger to manage incremental processes, while none of these have proven to be effective or robust. This has seriously hampered the ability for the community to build logic to monitor Assets such as object stores, SQL databases, and other non-queue/stream-based Assets. With AIP-103, this state store will be developed and available to use as part of this AIP.
For Triggers built for "Asset watching", it is helpful, if not essential to persist some state. This AIP will provide an interface for using the state store built by AIP-103 for "Asset watching".
Considerations
What change do you propose to make?
At a high level, we propose to make the following changes:
- Pass through context including the Asset being "watched" to the
BaseEventTriggerto make theBaseEventTriggerAsset-aware. - (Stretch Goal) Provide a more intuitive, decorator-based approach for authoring logic used for "Asset watching".
What problem does it solve?
This solves one of the most glaring problems with building Triggers compatible with "Asset-watching", or event-driven scheduling; the inability to persist and retrieve state for an Asset. Without a way to retrieve the state for an Asset , it's nearly impossible to do things like monitor an S3 bucket for new files landing or handle the addition/removal of a new row to a SQL database. Despite being one of the most touted features of Airflow 3.0, the community has been very slow to develop and distribute Event Triggers to be used for "Asset-watching". This AIP aims to address this problem using the work laid in AIP-103.
Technical Details
The important thing about this change is this; this is not a breaking change to any existing processes. The same interface will be used to define AssetWatcher 's; a BaseEventTrigger is defined and passed to the AssetWatcher . Then, the AssetWatcher is passed to the Asset via the watchers parameter. At runtime, a reference to the Asset will be passed through to the BaseEventTrigger , allowing for the Trigger to be Asset-aware.
Defining Assets and AssetWatchers
from airflow.sdk import Asset, AssetWatcher
from plugins.triggers import GenericEventTrigger
... # Other imports
generic_asset_watcher = AssetWatcher(
name="generic_asset_watcher",
trigger=GenericEventTrigger(
...
)
)
generic_asset = Asset(
name="generic_asset",
watchers=[generic_asset_watcher]
)
with DAG(
dag_id="my_dag",
start_date=datetime(2026, 1, 1),
schedule=[generic_asset]
) as dag:
...
BaseEventTrigger
TODO: Update this.
Examples
“Watching” an S3 Bucket
One of the most common use-cases for event-driven scheduling will most likely be “watching” an object store for changes. Ideally, each time that an AssetWatcher ’s Trigger runs, it should not re-scan the entire bucket. The workflow would look something like this:
- After the first Trigger run, a timestamp of this “scan” of the Asset is recorded.
- On the second run, the Trigger retrieves the timestamp (watermark) from the completion of the last run for that Asset and only scans the object store for files after that watermark.
- Trigger writes the state for the Asset again.
- Process repeats for N Trigger runs following.
Incremental Data in SQL Databases
Another common use-case for event-driven scheduling is “watching” tables in relational databases; we’ll use Postgres as an example. Outside of traditional CDC, it’s common for data teams to use an updated column in a Postgres database to upsert data. This workflow should feel quite similar to the workflow for “watching” an S3 Bucket; that’s intentional, as we’re trying to implement a repeatable pattern.
- After the first Trigger run, a timestamp of this “scan” of the Asset is recorded and persisted.
- On the second run, the Trigger retrieves the state for that Asset from the completion of the last run and only scans the updated column in the desired table for records with a timestamp greater than the watermark.
- Trigger updates the state of the Asset again.
- Process repeats for N Trigger runs following.
Why is it needed?
Being able to persist and access the state of an Asset unblocks the development of Event Triggers for Airflow users interested in "Asset-watching".
Are there any downsides to this change?
No, there are no significant downsides to this change. This will not be a breaking change.
Which users are affected by the change?
DAG Authors: these users will now have access to a tool that makes authoring Triggers, Sensors, and Tasks used to orchestrate incremental processes more accessible and unlocks the ability to further build out event-driven logic.
How are users affected by the change? (e.g. DB upgrade required?)
Current users who don't use incremental event triggers are unaffected by this change. Users who are "Asset-watching" will now have the ability to make these process Asset-ware and persist state for that Asset.
What is the level of migration effort (manual and automated) needed for the users to adapt to the breaking changes? (especially in context of Airflow 3)
There are not breaking changes included as part of this AIP.
Other considerations?
- This would be compatible with Asset partitions.
What defines this AIP as "done"?
This AIP will be considered “done” when the PR creates passes through the needed context to make BaseEventTrigger Asset-aware and the solution is well-documented.