https://dagster.io/ logo
#ask-community
Title
# ask-community
c

Chaitya

07/10/2023, 3:24 PM
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

chris

07/10/2023, 6:19 PM
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

Dagster Bot

07/10/2023, 6:20 PM
Question in the thread has been surfaced to GitHub Discussions for future discoverability: https://github.com/dagster-io/dagster/discussions/15197
c

Chaitya

07/13/2023, 7:57 PM
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

sean

07/13/2023, 9:27 PM
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

Chaitya

07/17/2023, 2:07 PM
Thanks!
2 Views