Alec Koumjian
04/19/2023, 6:58 PMdata_version
of an upstream asset, perhaps in the context
somewhere?owen
04/19/2023, 7:19 PMfrom dagster._core.definitions.data_version import (
extract_data_version_from_entry,
)
@asset
def foo(context, upstream_asset):
upstream_entry = context.get_step_execution_context().get_input_asset_record(AssetKey("upstream_asset")).event_log_entry
upstream_version = extract_data_version_from_entry(upstream_entry)
Alec Koumjian
04/20/2023, 1:40 PMlatest_record = context.instance.get_latest_data_version_record(
AssetKey("asset_key")
)
But using the execution context seems better since it will guarantee we are using the event log entry that corresponds with the version loaded in the downstream asset rather than the latest.