Skip to content

How to define an unpartitioned asset that depends on all upstream partitions #15375

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

You must be logged in to vote

When an unpartitioned asset is downstream of a partitioned asset, dagster automatically infers that the unpartitioned asset depends on all upstream partitions. The opposite applies as well when the unpartitioned asset is upstream of a partitioned asset--each downstream partition depends on the upstream unpartitioned asset.

You can define this relationship in code as follows:

@asset(partitions_def=DailyPartitionsDefinition("2023-01-01"))
def daily_data():
    ...

@asset
def aggregated_report(context, daily_data):
    context.log.info(daily_data) # the default IO manager returns a dictionary of outputs mapped by partition key {"2023-01-01": ..., "2023-01-02": ..., ...}
    ...

Under the ho…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@emirkmo
Comment options

@clairelin135
Comment options

@ChanTheDataExplorer
Comment options

Answer selected by clairelin135
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 area: asset Related to Software-Defined Assets
3 participants