Hi all, quick question about accessing metadata on...
# ask-community
g
Hi all, quick question about accessing metadata on
AssetMaterialization
events. I have an
op
which yields this event:
Copy code
yield AssetMaterialization(
    asset_key="something_important",
    metadata={
        "path": EventMetadata.text("path/to/something/important")
    }
)
I have a
job
in a completely different repository listening for this event, which relies on that value for
path
in the metadata. I've found that I can access the metadata in my
asset_sensor
function using this:
Copy code
asset_event.dagster_event.event_specific_data.materialization.metadata_entries[0].entry_data.text
This seems a bit convoluted though. Is there a better way to access
AssetMaterialization
metadata so that it can be passed on to future jobs?
❤️ 1
c
Hey Ginger, thanks for the question. Unfortunately this is currently the only way to access metadata from asset events, though we'd like to eventually improve this.
g
Thank you @claire for confirming! I just wanted to make sure there wasn't a better way to do this!