How do you access the definition metadata for an upstream asset? #21830
-
If I define metadata in the decorator of an asset, how do I grab that metadata in a downstream asset? For example, in the following code, how do I access the metadata of small_petals in downstream_asset through the context?
I understand there is a way to get the latest upstream materialization metadata through the context, but I'm confused about how to access the definition metadata. Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Definition-level metadata is typically meant for showing in the UI in a current context. So it's not automatically persisted on historical materialization events. Nevertheless, you can access it in a downstream asset by importing the asset's definition (defs): @asset(deps=["usptream"])
def downstream():
from top_level_module import defs
upstream_metadata = defs.get_asset_graph().get(AssetKey("upstream")).metadata |
Beta Was this translation helpful? Give feedback.
Definition-level metadata is typically meant for showing in the UI in a current context. So it's not automatically persisted on historical materialization events. Nevertheless, you can access it in a downstream asset by importing the asset's definition (defs):