https://dagster.io/ logo
#ask-community
Title
# ask-community
d

Dimitris Stafylarakis

04/08/2022, 7:50 PM
hey there! A small question regarding software-defined assets. Some metadata are being “discovered” in an asset, that I’d like to pass to a downstream asset. How could I do that? If I attach them to the Output, how can the downstream asset access them? Thanks in advance 🙂
c

claire

04/08/2022, 8:24 PM
Hi Dimitris. Currently there is no way to get the metadata from the output object, but this is a known pain point that we're working on actively improving. For now, you could do something like:
Copy code
@asset
def my_asset():
    yield Output(5, metadata={"foo":"bar"})

@asset
def asset2(context, my_asset):
    record = context.instance.get_event_records(EventRecordsFilter(DagsterEventType.ASSET_MATERIALIZATION, AssetKey("my_asset")), limit=1)[0]
    metadata = record.event_log_entry.dagster_event.event_specific_data.materialization.metadata_entries
d

Dimitris Stafylarakis

04/08/2022, 8:29 PM
hi Claire, thanks for your answer! looking forward to the improved version 😄