Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YearlyPartitionsDefinition #21863

Open
mkleinbort-ic opened this issue May 15, 2024 · 2 comments
Open

Add YearlyPartitionsDefinition #21863

mkleinbort-ic opened this issue May 15, 2024 · 2 comments
Labels

Comments

@mkleinbort-ic
Copy link

What's the use case?

We have hourly, daily, weekly and monthly partition definitions... it feels natural to add yearly as well (I was looking for it today and could not find it).

The alternative is for users to use StaticPartitionDefinition (or Dynamic) which looses some of the benefits of a time-based partition.

Ideas of implementation

No response

Additional information

This is useful for large scale "backfills", often partitioned by entities in the context of a MultiPartition.

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

@ion-elgreco
Copy link
Contributor

ion-elgreco commented May 18, 2024

While at it, let's also have QuarterlyPartitionDefinition

@mmutso-boku
Copy link

The alternative is for users to use StaticPartitionDefinition (or Dynamic) which looses some of the benefits of a time-based partition.

I think the better alternative is to use TimeWindowPartitionsDefinition and specify the cron_schedule parameter as needed, for example:

quarterly_partitions_def = TimeWindowPartitionsDefinition(
    start=datetime(2015, 1, 1),
    cron_schedule="0 0 1 */3 *",
    fmt="%Y-%m")

half_year_partitions_def = TimeWindowPartitionsDefinition(
    start=datetime(2015, 1, 1),
    cron_schedule="0 0 1 */6 *",
    fmt="%Y-%m")

yearly_partitions_def = TimeWindowPartitionsDefinition(
    start=datetime(2015, 1, 1),
    cron_schedule="0 0 1 1 *",
    fmt="%Y")

At least that's what I've been using so far, and seems to have worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants