Skip to content

Instantly share code, notes, and snippets.

@cnolanminich
Last active June 18, 2024 19:54
Show Gist options
  • Save cnolanminich/ceecafc4a8eb95f8e5e097f16e5a305b to your computer and use it in GitHub Desktop.
Save cnolanminich/ceecafc4a8eb95f8e5e097f16e5a305b to your computer and use it in GitHub Desktop.
Example of assets that take deps from a set of other assets
#assets you want to put in the initial asset group
from dagster import (
asset,
)
# Define your assets and group them
@asset
def asset1():
pass
@asset
def asset2():
pass
from dagster import (
asset,
load_assets_from_modules
)
# this should be the filename of the module with the assets you want to use
from . import asset_group1
@asset(deps=load_assets_from_modules([asset_group1]) )
def downstream_asset():
pass
from dagster import (
Definitions,
load_assets_from_modules,
)
from . import asset_group1, asset_group2
asset_group1 = load_assets_from_modules([asset_group1], group_name="GROUP1")
asset_group2 = load_assets_from_modules([asset_group2], group_name="GROUP2")
defs = Definitions(
assets=[*asset_group1, *asset_group2],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment