https://dagster.io/ logo
#ask-ai
Title
# ask-ai
s

Stephen Bailey

02/07/2024, 7:12 PM
How can I specify a non_argument_dep for a graph_asset
s

Scout

02/07/2024, 7:12 PM
To specify non-argument dependencies for a
graph_asset
, you can use the
ins
parameter of the
@graph_asset
decorator to map input names to
AssetIn
objects that specify the dependencies. The
AssetIn
object can be configured with
dagster_type=Nothing
, indicating that the asset does not expect a runtime value but does have a dependency on another asset. Here's an example from the documentation that demonstrates how to specify dependencies for a `graph_asset`:
Copy code
python from dagster import graph_asset, asset, AssetIn, op, Nothing, In  @asset def upstream():     ...  @op(ins={"upstream": In(Nothing)}) def my_op():     return ...  @graph_asset(     ins={"upstream": AssetIn(dagster_type=Nothing)}, ) def my_graph_asset(upstream):     return my_op(upstream)
In this example,
my_graph_asset
has a non-argument dependency on the
upstream
asset. The
upstream
input to the
my_graph_asset
function is mapped to an
AssetIn
with
dagster_type=Nothing
, which establishes the dependency without passing a runtime value.
3 Views