Iliya R
11/28/2026, 6:57 PMStefan Krawczyk
11/28/2026, 8:31 PMNodeExecutionHook should work for this. Materializers execute as regular Hamilton nodes tagged with hamilton.data_saver=True, and the post-node hook receives success plus the metadata returned by DataSaver.save_data(). So you can register an adapter with Builder.with_adapters(...), filter for successful saver nodes, and emit the Airflow asset event there.
Roughly: from hamilton.lifecycle import api
class AssetEventHook(api.NodeExecutionHook):
def run_before_node_execution(self, **kwargs):
pass
def run_after_node_execution(
self, *, node_name, node_tags, success, result, **kwargs
):
if success and node_tags.get("hamilton.data_saver") is True:
emit_asset_event(
materializer_id=node_name,
metadata=result,
)
Our OpenLineage adapter already uses this general pattern for successful loader/saver nodes.
Putting the event emission directly in a custom DataSaver.save_data() would also work. I’d lean toward the lifecycle hook when this is an orchestration/observability side effect, since it keeps Airflow-specific behavior separate from storage. A custom saver makes more sense if saving and publishing the event intentionally form one operation.
One caveat: the event is emitted after the save succeeds, but it isn’t transactional with the save. If event publication fails, Hamilton can’t roll back the saved data, so the callback should ideally be idempotent/retry-safe.Stefan Krawczyk
11/28/2026, 8:31 PMIliya R
11/28/2026, 8:46 PMStefan Krawczyk
11/28/2026, 8:50 PMasset_uris = {
"save_orders": "s3://bucket/orders.parquet",
"save_customers": "s3://bucket/customers.parquet",
}
class AirflowAssetHook(api.NodeExecutionHook):
def __init__(self, asset_uris):
self.asset_uris = asset_uris
def run_before_node_execution(self, **kwargs):
pass
def run_after_node_execution(
self, *, node_name, node_tags, success, result, **kwargs
):
uri = self.asset_uris.get(node_name)
if (
success
and node_tags.get("hamilton.data_saver") is True
and uri is not None
):
emit_airflow_asset_event(uri=uri, metadata=result)
Then construct the driver with that provider configuration: dr = (
driver.Builder()
.with_modules(my_dataflow)
.with_adapters(AirflowAssetHook(asset_uris))
.with_materializers(*all_n_materializers)
.build()
)
All N materializers still save their outputs. The hook sees all successful saver executions, but only emits for the K whose materializer IDs appear in asset_uris.
I’d key this by materializer ID rather than by the upstream computation node, because the event represents a particular persisted asset and one computation node could be saved to multiple destinations. The URI could also be taken from the saver’s returned metadata where available, but an explicit ID-to-URI mapping is probably clearer and more reliable for an Airflow provider?