-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Partition enhancements for peripheral features #62463
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
Open
uranusjr
wants to merge
9
commits into
apache:main
Choose a base branch
from
astronomer:dag-model-next-partition-key
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,466
−2,276
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
720d831
Add flag to identify partitioning timetable
uranusjr 8c3f587
Add partition fields to dag model
uranusjr 7cfeb9c
Rewrite next-execution CLI to print partition key
uranusjr 32cccc8
Fix lint and test errors
uranusjr 67703ed
Add partition key case to next-execution test
uranusjr e6c354d
Typo in migration file name
uranusjr c1124e8
Update dag_next_execution docstring
uranusjr 3dbc587
Merge branch 'main' into dag-model-next-partition-key
uranusjr 5bbb170
Remove unneeded logic in CronPartitionTimetable
uranusjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 75b0a307d3e928e2ec33cdf599198252d6f0267d6aa8abcdc8eb9c6d065a2bc2 | ||
| f94e161c1401142bd9e2c2e9ce3eda3fcda3fb203adbfaaaf9c27ac27cd5499b |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
airflow-core/src/airflow/migrations/versions/0107_3_2_0_add_partition_fields_to_dag.py
uranusjr marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """ | ||
| Add partition fields to DagModel. | ||
|
|
||
| Revision ID: 6222ce48e289 | ||
| Revises: 134de42d3cb0 | ||
| Create Date: 2026-02-25 06:29.58.176890 | ||
|
|
||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| from airflow.utils.sqlalchemy import UtcDateTime | ||
|
|
||
| revision = "6222ce48e289" | ||
| down_revision = "134de42d3cb0" | ||
| branch_labels = None | ||
| depends_on = None | ||
| airflow_version = "3.2.0" | ||
|
|
||
|
|
||
| def upgrade(): | ||
| """Add partition fields to DagModel.""" | ||
| with op.batch_alter_table("dag", schema=None) as batch_op: | ||
| batch_op.add_column( | ||
| sa.Column("timetable_partitioned", sa.Boolean, nullable=False, server_default="0"), | ||
| ) | ||
| batch_op.add_column(sa.Column("next_dagrun_partition_key", sa.String(255))) | ||
| batch_op.add_column(sa.Column("next_dagrun_partition_date", UtcDateTime)) | ||
| with op.batch_alter_table("dag_run", schema=None) as batch_op: | ||
| batch_op.add_column(sa.Column("partition_date", UtcDateTime)) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| """Remove partition fields from DagModel.""" | ||
| with op.batch_alter_table("dag", schema=None) as batch_op: | ||
| batch_op.drop_column("timetable_partitioned") | ||
| batch_op.drop_column("next_dagrun_partition_key") | ||
| batch_op.drop_column("next_dagrun_partition_date") | ||
| with op.batch_alter_table("dag_run", schema=None) as batch_op: | ||
| batch_op.drop_column("partition_date") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised we don't support mutually exclusive by default, and noticed the messages are quite different for such cases. not something we should change in the PR though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised too