Emmanuel Ogunwede
01/26/2023, 1:47 PMsandy
01/26/2023, 3:36 PMEmmanuel Ogunwede
01/26/2023, 3:43 PM2022-12-01
• The file name will be 2022-12-01.parquet
• The s3 url will become <s3://known_Bucket_Name/2022-12-01.parquet>
sandy
01/26/2023, 11:02 PMEmmanuel Ogunwede
01/27/2023, 1:49 AMsandy
01/27/2023, 1:57 AMfrom dagster import asset, DailyPartitionsDefinition
partitions_def = DailyPartitionsDefinition(start_date="2020-01-01")
def _make_file_path(context, asset_name):
return f"<s3://my_bucket_name/{asset_name}/{context.partition_key}>"
@asset(partitions_def=partitions_def)
def asset1(context) -> None:
output_path = _make_file_path(context, "asset1")
# write to S3
@asset(partitions_def=partitions_def, non_argument_deps={"asset1"})
def asset2(context) -> None:
input_path = _make_file_path(context, "asset1")
# read from S3
we usually recommend against @asset
-decorated functions returning URLs and paths, because, for it to be a good use case for software-defined assets, normally the path is known ahead of time, so there's no need for the downstream step to find it out dynamicallyEmmanuel Ogunwede
01/27/2023, 12:38 PM