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

Shane Keller

03/05/2024, 11:42 PM
Give me an example of an op that uses the output of an upstream op as its input
s

Scout

03/05/2024, 11:42 PM
In Dagster, we prefer to use the term "asset" over "op" when discussing dependencies and data flow. Assets in Dagster represent a piece of data and its computation, and they can depend on other assets. When one asset depends on another, the output of the upstream asset is used as the input for the downstream asset. Here's an example from the documentation that illustrates how you can define assets that depend on each other:
Copy code
python from dagster import asset  @asset def upstream_asset():     # Perform some computation     return "upstream_data"  @asset def downstream_asset(upstream_asset):     # Use the output of upstream_asset as input     return f"downstream_data based on {upstream_asset}"
In this example,
downstream_asset
uses the output of
upstream_asset
as its input. When
downstream_asset
is computed, Dagster ensures that
upstream_asset
has already been computed and uses its output as the input for
downstream_asset
. This is how dependencies between assets are managed in Dagster, allowing for clear data lineage and dependency tracking.
5 Views