Skip to content

How to get all asset keys of assets that are in a particular group? #27312

Discussion options

You must be logged in to vote

There's a way to do that using AssetSelection syntax:

group_selection = AssetSelection.groups("some_group")
asset_keys = selection.resolve(context.repository_def.asset_graph)

You can also get the asset key of the most downstream asset within a group using sinks. A sink asset is an asset that has no downstream dependencies within the asset selection. The sink asset can have downstream dependencies outside of the asset selection.

downstream_asset_in_group_selection = AssetSelection.groups("some­_group").sinks()
asset­_keys = selection.resolve(context.repository­_def.asset­_graph)

You can also get the asset key of the most upstream asset within a group using roots(). A root asset is an asset…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by garethbrickman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area: asset Related to Software-Defined Assets
1 participant