Skip to content

How to use MultiPartitions and DynamicPartitions together? #14334

Answered by jamiedemaria
jamiedemaria asked this question in Q&A
Discussion options

You must be logged in to vote

yes it is! here is a code sample

from dagster import asset, MultiPartitionsDefinition, DynamicPartitionsDefinition, Definitions, DailyPartitionsDefinition

dynamic_colors = DynamicPartitionsDefinition(name="dynamic_colors")

partitions_def = MultiPartitionsDefinition(
            {
                "time": DailyPartitionsDefinition(start_date="2022-01-01"),
                "color": dynamic_colors,
            }
        )

@asset(
    partitions_def=partitions_def
)
def mutli_dynamic_asset(context):
    partition = context.partition_key.keys_by_dimension
    context.log.info(f"Partition: time: {partition['time']}, color: {partition['color']}")

defs = Definitions(
    assets=[mutli_dynamic_…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@andkuzmich
Comment options

@jamiedemaria
Comment options

jamiedemaria Jul 24, 2024
Maintainer Author

Answer selected by jamiedemaria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area: partitions Related to Partitions
2 participants