Tom Reilly
02/16/2023, 11:24 PMowen
02/16/2023, 11:37 PM@sensor
def my_sensor(context):
new_materialization_records = context.instance.get_event_records(
EventRecordsFilter(
event_type=DagsterEventType.ASSET_MATERIALIZATION,
asset_key=SOME_KEY,
after_cursor=int(context.cursor) if context.cursor else 0,
),
ascending=False,
)
# ... do something for each new materialization
for record in new_materialization_records:
...
# ... get the max record.storage_id from those new records
...
# update the cursor so you know which records you've processed
context.update_cursor(str(max_storage_id))