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

Aaron

08/10/2022, 5:57 PM
Am I right in thinking that if using
define_asset_job
to create a job to materializes assets, I need to select all prerequisite assets rather than just the one I want? It would be nice if I could ask for only a specific asset (the one I’m interested in), and then dagster could figure out which upstream ones need to be computed based on knowledge of the dependencies. Is this behaviour possible at all?
dagster bot responded by community 1
t

Tom Reilly

08/10/2022, 6:26 PM
define_asset_job supports a selection param which can be an
AssetSelection
. AssetSelection has an upstream method that I think would solve your use case. Going off this example in the docstring it seems like you could do something like
Copy code
AssetSelection.keys("asset_abc").upstream()
where
asset_abc
is the key for the single asset you are interested in and pass that into the
selection
param of
define_asset_job
a

Aaron

08/10/2022, 6:31 PM
Ah, I’d noticed the
selection
param and
AssetSelection
, but hadn’t noticed the
upstream
method. I’ll give that a try - thanks!