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

Wellington Braga

02/21/2023, 8:54 PM
Hello 👋 I'm starting to study Dagster and I'm having a little trouble understanding how I could create dependencies between assets. I would like to create a dependency between
baz_asset
and
foo_asset
. Could someone give me a north?
r

Rasmus Bonnevie

02/21/2023, 9:46 PM
dependencies are easier outside of a single graph, but here's the docs for within-graph dependencies: https://docs.dagster.io/concepts/assets/graph-backed-assets#defining-explicit-dependencies-for-graph-backed-assets
c

claire

02/22/2023, 6:01 PM
Hi Wellington. You could define dependencies between
@asset
objects like this: https://docs.dagster.io/concepts/assets/software-defined-assets#defining-basic-dependencies By default, Dagster assumes that each asset generated from a graph backed asset depends on the input assets. If this is not the case, you can specify an
internal_asset_deps
argument, something like this:
Copy code
AssetsDefinition.from_graph(
            my_graph,
            internal_asset_deps={"baz_asset": {AssetKey("foo_asset")}, "foo_asset": set()},
            keys_by_output_name={
                "foo_asset": AssetKey("foo_asset"),
                "baz_asset": AssetKey("baz_asset"),
            },
        )
The
internal_asset_deps
argument defines the dependency relationships between the assets in the graph.