pass down asset partitions to ops in a graph #17916
-
Hi! How can I pass down asset partitions to ops in a graph? from dagster import DailyPartitionsDefinition, OpExecutionContext, graph_asset, op
import pandas as pd
@op(
required_resource_keys={"snowflake_airbyte_manager"},
)
def create_table(context: OpExecutionContext) -> bool:
context.log.info(context.asset_partitions_time_window_for_output())
return True
@op(
required_resource_keys={"snowflake_airbyte_manager"},
)
def replace_table(context: OpExecutionContext, tbl) -> None:
context.log.info(context.asset_partitions_time_window_for_output())
return True
@graph_asset(
group_name="kunal_test",
partitions_def=DailyPartitionsDefinition(start_date="2023-01-01"),
)
def kunal_test_graph_asset() -> pd.DataFrame:
return replace_table(create_table()) In this simple example, I'm able to get the asset partitions in the Op
How can I propagate the partitions to The question was originally asked in Dagster Slack. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi there -- I believe the Within the op you can call |
Beta Was this translation helpful? Give feedback.
Hi there -- I believe the
context.asset...
methods may only work when invoked within asset execution, and not within op execution.Within the op you can call
context.partition_time_window
instead.