Skip to content

Customize monthly partition #21401

Closed Answered by garethbrickman
brandybobandyistaken asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the MonthlyPartitionsDefinition class provided by Dagster, and then customize the asset computation to filter data based on the specific time bounds you need.

How you might set this up:

  1. Define your monthly partitions with a MonthlyPartitionsDefinition that starts on the first of the month.

  2. Schedule the asset to run on the fourth of the month. This can be done using a sensor or a schedule that triggers the materialization of the asset.

  3. Within the asset computation, use the context.partition_time_window to get the start and end bounds of the partition. Then, adjust the end bound to be three days after the end of the month.

Here's an example of how you might define such a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brandybobandyistaken
Comment options

Answer selected by garethbrickman
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