Erik Goldman
04/24/2023, 4:26 PMlist[str]
of episode ids, and then I’m trying to set up a sensor to listen for that and use dynamic partitioning to emit a partition with the key == the episode id to trigger the episode assets
1. is that the right approach?
2. how do I get the list[str]
in my sensor? I’m not sure I understand the API calls to fetch the actual data returnedsandy
04/24/2023, 4:46 PMErik Goldman
04/24/2023, 4:48 PMsandy
04/24/2023, 5:02 PMfrom dagster import asset, DynamicPartititionsDefinition, AutoMaterializePolicy
seasons_partitions_def = DynamicPartititionsDefinition(name="seasons")
episodes_partitions_def = DynamicPartititionsDefinition(name="episodes")
@asset(partitions_def=seasons_partitions_def)
def seasons(context) -> None:
episodes = find_episodes_for_season(season=context.partition_key)
context.instance.add_dynamic_partitions(episodes_partitions_def, episodes)
@asset(
partitions_def=episodes_partitions_def,
auto_materialize_policy=AutoMaterializePolicy.eager(),
)
def episodes(context):
episode = context.partition_key
...
Erik Goldman
04/24/2023, 5:03 PMseasons
? or is the partition_key
the only thing that they can communicate with?sandy
04/24/2023, 5:57 PMErik Goldman
04/24/2023, 5:59 PMsandy
04/24/2023, 6:56 PMErik Goldman
04/25/2023, 5:28 PMJustin Taylor
05/19/2023, 6:12 PMseasons
example, suppose that find_episodes_for_season
returns a data frame. If I wanted to add one column of the data frame as a partition key, as well as do something else with the rest of the data frame downstream in a different SDA, would I create one SDA to generate + add the partition keys and another SDA to get the entire data frame that I want?
Thanks in advance for any advice you might have!