Hello, I want to use YearlyPartitionDefinition. Is...
# ask-community
g
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
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