Can i get access to the metadata of an asset/job/o...
# ask-community
c
Can i get access to the metadata of an asset/job/op in a sensor? based on meta data i'd prefer to do different things, if possible.
🤖 1
it was possible by getting the asset definition and using
metadata_by_key
for the static metadata, and a attribute on the event for the run-time metadata
m
id like to be able to do this - how did you get the asset definition in the sensor?
c
I'll have to look through our git history. gimme a sec
metadata = asset.metadata_by_key.get(asset_key)
and i got the asset via
asset = context.assets_defs_by_key[asset_key]
(remember to assert that these things are not None). And the asset key, for completion sake:
Copy code
for (
            asset_key,
            materialization,
        ) in context.latest_materialization_records_by_key().items():
m
wow great thanks! will give that a go