Simon
04/20/2022, 4:03 PMOut
does (https://docs.dagster.io/_apidocs/ops#dagster.Out) but that seems like I'd be hardcoding it to a fixed partition (I don't really understand the usecase for this tbh). Is there something else I need to do to link an Op to a partitioned Asset?johann
04/20/2022, 6:23 PMclaire
04/20/2022, 7:33 PM@daily_partitioned_config(start_date=datetime(2020, 1, 1))
def my_partitioned_config(start: datetime, _end: datetime):
return {
"ops": {
"my_op": {"config": {"date": start.strftime("%Y-%m-%d")}}
}
}
@op
def my_op(context):
context.log_event(AssetMaterialization(asset_key=AssetKey("my_asset"), partition=context.op_config["date"]))
@job(config=my_partitioned_config)
def do_stuff_partitioned():
my_op()
Simon
04/21/2022, 7:17 AMclaire
04/21/2022, 4:21 PMdaily_partitions_def = DailyPartitionsDefinition(start_date="2020-01-01")
@asset(partitions_def=daily_partitions_def)
def daily_partitioned_asset():
return 1
Then if you execute the job for a certain partition, dagster will automatically generate an asset materialization for the asset partition.Simon
04/21/2022, 4:23 PMOp
and it seems like you can't combine Op
with assets (or actually you can, see https://docs.dagster.io/concepts/assets/asset-materializations#linking-assets-to-an-output-definition- but not with partitions)claire
04/21/2022, 4:26 PMSimon
04/21/2022, 4:32 PMclaire
04/21/2022, 4:41 PMSimon
04/21/2022, 4:41 PM