Skip to content

How to get the data version of an upstream asset, while computing a downstream asset #14723

Answered by sryza
sryza asked this question in Q&A
Discussion options

You must be logged in to vote
from dagster import asset, observable_source_asset, DataVersion


@observable_source_asset
def asset1():
    return DataVersion("5")


@asset(non_argument_deps={"asset1"})
def asset2(context):
    latest_materialization_event = context.get_step_execution_context().get_input_asset_record(asset1.key).event_log_entry
    upstream_data_version = latest_materialization_event.tags.get("dagster/data_version")

This should also work if the upstream asset is a regular materializable asset instead of an observable source asset.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@amardeep
Comment options

@sryza
Comment options

@lfrkncht
Comment options

Answer selected by sryza
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area: asset Related to Software-Defined Assets
3 participants