Hi guys :wave: Is it possible, without implementin...
# ask-community
Hi guys 👋 Is it possible, without implementing a custom IO manager, to get only the metadata of the upstream asset, without loading it? For example, I would have an asset that is stored in s3 and a downstream one that would only get its path (which is in the metadata) to run a COPY from s3 to Redshift. In this case, there is no need to load the data, just get the path and run the SQL query.
🤖 1
dagster bot responded by community 1
If I understand your problem correctly, this is a recurring issue. @sandy offers some workarounds for accessing materialization metadata here: https://github.com/dagster-io/dagster/issues/8521 I integrated them in my own repo as 3 utils:
Copy code
def get_asset_metadata(instance, asset_key):
    event_log_entry = instance.get_latest_materialization_event(asset_key)
    return event_log_entry.dagster_event.event_specific_data.materialization.metadata

def get_asset_metadata_within_io_manager(context, asset_key):
    return get_asset_metadata(context.step_context.instance, asset_key)

def get_asset_metadata_within_asset(context, asset_key):
    return get_asset_metadata(context.instance, asset_key)
❤️ 1
I found that I could use
but it doesn't seem to work with
. But indeed, I will need it too, thanks, I will take a look.