Created
April 19, 2023 18:29
-
-
Save slopp/cebf04bb47fe606a6561e023cc8a976f to your computer and use it in GitHub Desktop.
Asset Factory Example
This file contains hidden or 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, Definitions, AssetIn | |
assets_to_make = ["a", "b", "c"] | |
def make_assets(asset_to_make): | |
@asset( | |
name=asset_to_make | |
) | |
def asset_template(): | |
print(asset_to_make) | |
return | |
return asset_template | |
factory_assets = [make_assets(key) for key in assets_to_make] | |
factory_assets_ins = dict(zip(assets_to_make, [AssetIn(i) for i in assets_to_make])) | |
@asset | |
def downstream_of_factory_one(a): | |
pass | |
@asset( | |
ins=factory_assets_ins | |
) | |
def downstream_of_factory_all(**kwargs): | |
pass | |
defs = Definitions( | |
assets=[*factory_assets, downstream_of_factory_one, downstream_of_factory_all] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment