Using dagster
I’d like to create a set of reusable assets in a single file where I’d like to be able to pass a country parameter and have different schedules for each country/schedule. The only way I know how to do this is via setting up separate asset files for each country and then define the schedule in the __init__.py
file for each.
An example asset is below, where all the asset code is the same except for the country variable, I’m not sure how to pass the country from a Config
to the shared data_loader
object:
country = 'JP'
data_loader= DataLoader(country=country)
@asset(partitions_def=daily_partitions_def)
def my_asset(context):
dt = context.partition_key
return RunMyAsset(data_loader=data_loader, country=country).calc(dt)
@asset(partitions_def=daily_partitions_def)
def my_asset2(context):
dt = context.partition_key
return RunMyAsset2(data_loader=data_loader, country=country).calc(dt)