Hey folks, is it possible to get a reference to th...
# ask-community
c
Hey folks, is it possible to get a reference to the assets_definition of all of the other assets being materialized in a particular dagster run from within an asset? i.e. via the context object? I'd like to get the asset code_version for all assets being materialized.
🤖 1
I can get all asset versions for the current asset by doing:
Copy code
context.assets_def.code_versions_by_key
I can get all asset keys being materialized via:
Copy code
context.instance.all_asset_keys()
Any ideas on how I can get the code version for all of the assets?
c
I’m not sure the answer here but I think it’s worth surfacing
🙏 1
@Dagster Bot discussion get code versions for a set of assets being materialized
d
Question in the thread has been surfaced to GitHub Discussions for future discoverability: https://github.com/dagster-io/dagster/discussions/15197
c
Any other thoughts on this one...? I'm thinking about passing a dict of assets into my asset as part of the run configuration, but it doesn't seem very clean
s
Hi Chaitya, This isn’t currently possible via public APIs-- I opened an issue and posted it on the discussion that Chris linked. However, we can’t guarantee the stability of these APIs, but if you really need this info you can do:
context.job_def.asset_layer.code_version_for_asset(<asset_key>)
c
Thanks!