Last active
June 18, 2024 19:54
-
-
Save cnolanminich/ceecafc4a8eb95f8e5e097f16e5a305b to your computer and use it in GitHub Desktop.
Example of assets that take deps from a set of other assets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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