Hey all, is there a way to have wildcards in `Asse...
# ask-community
n
Hey all, is there a way to have wildcards in
AssetSelection
? For instance, I have a bunch of objects that have keys like
["grandparent", "parent", "child"]
and I want to select everything under
parent
I tried something like
AssetSelection.keys(["grandparent", "parent", "*"])
and
AssetSelection.keys(["grandparent", "parent"])
but those failed
d
n
Hey Drew, appreciate the response. I don't think I see anything for my use case though. It seems like everything there is pinned on first providing the full key for a specific op, no wildcards
t
How about:
Copy code
AssetSelection.keys(["grandparent"]) + AssetSelection.keys(["parent"]).downstream()
? The
.downstream()
method will pick up all assets that depend on that asset key and and of those children.
This was assuming that you didn't want `"grandparent"`'s children, too. If all you actually want is a specific asset and all of its downstream, you can use:
AssetSelection.keys(["grandparent"]) .downstream()
n
Ah, I might not be explaining the situation well. There are no assets with key of just
"grandparent"
or parent. Grandparent and parent are key prefixes for the actually assets, all of which are
["grandparent", "parent", "something"]
. So in my case I want to select every asset that has the key prefixes of
["grandparent", "parent"]
t
Oh, they're prefixes and not assets. That's my fault! Give me a second to give an actual answer then I really should have caught that while I was writing the code snippets.
l
The source code for AssetSelection showed a few examples. The worst case you can use AssetSelection.all() and filter down the result set of asset keys.