https://dagster.io/ logo
#ask-community
Title
# ask-community
g

Gaurav Gurjar

03/03/2024, 2:30 PM
Hello, I want to use YearlyPartitionDefinition. Is there any reference just like the following snippet?
Copy code
from dagster import WeeklyPartitionsDefinition
from ..assets import constants

start_date = constants.START_DATE
end_date = constants.END_DATE

weekly_partition = WeeklyPartitionsDefinition(
    start_date=start_date,
    end_date=end_date
)
t

Tim Castillo

03/03/2024, 5:34 PM
Hi! There isn’t an out-of-the-box Yearly partition, but you can define it yourself using the
TimeWindowPartitionsDefinition
class in Dagster. There, you can define a cron schedule that will define a new partition every year. For example:
Copy code
from dagster import TimeWindowPartitionsDefinition
from ..assets import constants

start_date = constants.START_DATE
end_date = constants.END_DATE

yearly_partition = TimeWindowPartitionsDefinition(
    cron_schedule="0 0 1 1 *",
    start_date=start_date,
    end_date=end_date
)
💡 1