Skip to content

Fix airflowctl pools export/import dropping pool team ownership - #73132

Merged
henry3260 merged 1 commit into
apache:mainfrom
Eason09053360:fix-airflowctl-pools-export-import-team-name
Oct 16, 2026
Merged

henry3260 merged 1 commit into
apache:mainfrom
Eason09053360:fix-airflowctl-pools-export-import-team-name

Conversation

@Eason09053360

Copy link
Copy Markdown
Contributor

Why

Multi-team deployments assign a pool to a team through team_name, which decides who may use that
pool. airflowctl pools export never wrote the field and airflowctl pools import never read it
back, so a backup/restore cycle silently dropped that ownership.

Worse than an incomplete file: PoolsOperations.bulk serialises with a plain model_dump(), so
the omitted field still goes out as "team_name": null, and BulkPoolService.handle_bulk_create
treats it as explicitly provided and writes it over the existing row. airflowctl pools import --action-on-existing-key overwrite therefore clears the team on pools that had one, and reports
success.

airflow pools export / import — which these commands supersede, and which already carry a
@deprecated_for_airflowctl notice — do round-trip team_name. The field reached the old CLI in
#68110 and was never carried over, so this only bites users who followed the migration notice.

What

In airflow-ctl/src/airflowctl/ctl/commands/pool_command.py, export now emits team_name and
_import_helper reads it back with pool_config.get("team_name") — the same spelling
pool_import_helper uses in the command this one replaces, so files written before this change
still import.

test_export_includes_team_name and test_import_forwards_team_name cover the two halves; the
latter asserts on the serialised bulk body, so it pins what actually reaches the server. The
hand-rolled pool stubs in the existing export tests gained team_name to stay in step with
PoolResponse.

Open question

A hand-written file that omits team_name still sends null and still clears the team on
overwrite. That is unchanged here — same root cause as description and include_deferred being
reset to their defaults: bulk() sends every field unconditionally, defeating the server's
exclude_unset=True guard. Fixing it means changing what bulk() serialises, which shifts
overwrite semantics for those fields too and needs the same treatment in connection_command and
variable_command. (exclude_none=True, as the sibling pools.create / pools.update use, is
not enough — description defaults to "" and include_deferred to False.) Happy to open that
separately if you agree it should be split.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

@potiuk potiuk added the closed because of open PR limit Closed as a one-time step of introducing the open pull request limit label Sep 25, 2026
@potiuk

potiuk commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hello @Eason09053360 - thank you for your contributions to Apache Airflow!

The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 33 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:

These pull requests stay open because maintainers are already engaged in them - they count towards your limit:

This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are.

What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or gh pr reopen <PR_NUMBER> --repo apache/airflow. Reopen the ones you are ready to follow through - keep them rebased, respond to review comments and fix failing checks.

While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack.

Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wrap the bulk() call in try/except so this surfaces as a SystemExit
message instead of a traceback? It wouldn't change the rejection itself the
whole-batch behaviour is a server-side contract question, but the command
reports every other failure that way.

Multi-team deployments assign pools to a team via team_name. Backing pools
up and restoring them silently lost that ownership: the exported file never
carried the field, and an import with --action-on-existing-key overwrite
sent it as null, which the server then wrote back over the existing pool.

The deprecated airflow pools export/import that this command supersedes does
round-trip team_name, so the gap only bites users who follow the migration
notice onto airflowctl.
@Eason09053360
Eason09053360 force-pushed the fix-airflowctl-pools-export-import-team-name branch from e51fe27 to 4f00eb6 Compare October 16, 2026 02:03
@Eason09053360

Copy link
Copy Markdown
Contributor Author

Should we wrap the bulk() call in try/except so this surfaces as a SystemExit message instead of a traceback? It wouldn't change the rejection itself the whole-batch behaviour is a server-side contract question, but the command reports every other failure that way.

Thanks for reviewing! Test that traceback comes from this branch predating #73307, which made safe_call_command catch non-JSON errors such as the bare 500 a nonexistent team_name gets. Rebased onto main, the same import exits 1 with Server response error: …, so I've left _import_helper as is.

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix

@henry3260
henry3260 merged commit 91a8ab6 into apache:main Oct 16, 2026
98 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: airflow-ctl/v0-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ airflow-ctl/v0-1-test PR Link

henry3260 pushed a commit that referenced this pull request Oct 16, 2026
…ool team ownership (#73132) (#74846)

Multi-team deployments assign pools to a team via team_name. Backing pools
up and restoring them silently lost that ownership: the exported file never
carried the field, and an import with --action-on-existing-key overwrite
sent it as null, which the server then wrote back over the existing pool.

The deprecated airflow pools export/import that this command supersedes does
round-trip team_name, so the gap only bites users who follow the migration
notice onto airflowctl.
(cherry picked from commit 91a8ab6)

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Eason09053360 <[email protected]>
github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Oct 16, 2026
…ool team ownership (apache#73132)

Multi-team deployments assign pools to a team via team_name. Backing pools
up and restoring them silently lost that ownership: the exported file never
carried the field, and an import with --action-on-existing-key overwrite
sent it as null, which the server then wrote back over the existing pool.

The deprecated airflow pools export/import that this command supersedes does
round-trip team_name, so the gap only bites users who follow the migration
notice onto airflowctl.
(cherry picked from commit 91a8ab6)

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Eason09053360 <[email protected]>
shahar1 pushed a commit that referenced this pull request Nov 19, 2026
…ool team ownership (#73132) (#74846)

Multi-team deployments assign pools to a team via team_name. Backing pools
up and restoring them silently lost that ownership: the exported file never
carried the field, and an import with --action-on-existing-key overwrite
sent it as null, which the server then wrote back over the existing pool.

The deprecated airflow pools export/import that this command supersedes does
round-trip team_name, so the gap only bites users who follow the migration
notice onto airflowctl.
(cherry picked from commit 91a8ab6)

Co-authored-by: Y-C <[email protected]>
Co-authored-by: Eason09053360 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl backport-to-airflow-ctl/v0-1-test closed because of open PR limit Closed as a one-time step of introducing the open pull request limit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants