Setting the file. One moment.
Subchapter 2.4
references/assets/dependencies.mdMarkdown2 KBView on GitHub
When an asset depends on another Dagster-managed asset, add it as a function parameter. Dagster uses an IOManager to load the upstream asset’s output into memory and pass it as a Python object.
@dg.asset
def upstream_asset() -> dict:
return {"data": [1, 2, 3]}
@dg.asset
def downstream_asset(upstream_asset: dict) -> list:
# upstream_asset is loaded into memory via IOManager
return upstream_asset["data"]Use deps= to declare a data dependency for lineage and scheduling purposes only. The asset function does NOT receive the upstream data. Either the function itself handles data access (e.g. reading from a database directly), or some external process ensures the data is available.
@dg.asset(deps=["external_table", "raw_file"])
def processed_data() -> None:
# No upstream values passed in — read from sources directly
passprocessed_data should run after external_tableCombine both patterns when an asset has some IOManager-managed inputs and some loose data dependencies:
@dg.asset(deps=["raw_file"])
def enriched_data(reference_table: dict) -> dict:
# reference_table: loaded via IOManager (parameter-based)
# raw_file: declared dependency only, read manually
return {"enriched": reference_table}