From 09e658357939b698f62851eacf6b941c121512a9 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Tue, 29 Jul 2025 17:06:11 +0200 Subject: [PATCH] experiments with materialization --- apps/other/src/assets.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/other/src/assets.py b/apps/other/src/assets.py index 6edeef6..51ec5b5 100644 --- a/apps/other/src/assets.py +++ b/apps/other/src/assets.py @@ -1,4 +1,6 @@ +import os import sys +from collections.abc import Iterator from functools import partial from logging import getLogger @@ -46,3 +48,27 @@ def iris_cleaned(table: pa.Table) -> pa.Table: df = table.to_pandas() result_df = df.dropna().drop_duplicates() return pa.Table.from_pandas(result_df) + + +daily_partitions_def = dg.DailyPartitionsDefinition( + start_date="2024-09-01", end_offset=1, timezone=os.environ.get("TZ", "UTC") +) + + +@asset(partitions_def=daily_partitions_def) +def one() -> Iterator[dg.Output[int]]: + # Attempt to materialize multiple times + yield dg.Output(1) + yield dg.Output(2) + + # Error: Compute for op "other__one" returned an output "result" multiple times + + +@asset() +def two(context: dg.AssetExecutionContext) -> None: + # Attempt to log materialization of other asset + context.log_event( + dg.AssetMaterialization( + asset_key=one.key, partition="2025-07-27" + ) # this works! + )