Skip to content

GenericTransfer: switch paginated mode to non-deferred default with opt-in deferral#64321

Merged
dabla merged 15 commits intoapache:mainfrom
dabla:feature/allow-non-deferred-pagination-generic-transfer
May 4, 2026
Merged

GenericTransfer: switch paginated mode to non-deferred default with opt-in deferral#64321
dabla merged 15 commits intoapache:mainfrom
dabla:feature/allow-non-deferred-pagination-generic-transfer

Conversation

@dabla
Copy link
Copy Markdown
Contributor

@dabla dabla commented Mar 27, 2026

Add support for non-deferred pagination mode in GenericTransfer, as until now only deferred was supported which can be problematic with some backends.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@dabla dabla requested a review from ephraimbuddy March 27, 2026 18:57
@dabla dabla self-assigned this Apr 1, 2026
@kaxil kaxil requested a review from Copilot April 2, 2026 00:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an explicit deferrable/non-deferrable switch to GenericTransfer’s paginated mode so pagination can run eagerly (non-deferred) for backends where deferral is problematic.

Changes:

  • Introduces a deferrable parameter to GenericTransfer and implements an eager pagination loop when deferrable=False.
  • Updates unit tests to cover both eager (non-deferred) and deferred paginated execution.
  • Updates the public .pyi stub to expose the new deferrable parameter.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
providers/common/sql/src/airflow/providers/common/sql/operators/generic_transfer.py Adds deferrable param and non-deferred pagination execution path.
providers/common/sql/src/airflow/providers/common/sql/operators/generic_transfer.pyi Updates public typing stub to include deferrable.
providers/common/sql/tests/unit/common/sql/operators/test_generic_transfer.py Adds/adjusts tests for non-deferred and deferred paginated reads.

Copy link
Copy Markdown
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Functionally clean and CI is green. One blocker before this can land:

1. Document the default behaviour change in the provider changelog. Before this PR, paginated mode (page_size + str SQL) always deferred; after, it runs synchronously by default unless [operators] default_deferrable = true is set. That's a silent behaviour change for any existing DAG using paginated GenericTransfer. The provider's changelog.rst carves out exactly this case at the top: "only add notes to the Changelog… when there are some breaking changes and you want to add an explanation to the users on how they are supposed to deal with them." Please add an entry under the next-version heading in providers/common/sql/docs/changelog.rst covering the switch and the two ways to restore the old behaviour (pass deferrable=True per task, or set the global [operators] default_deferrable=true).

Two non-blocking suggestions:

2. The PR title reads as additive ("Add support for non-deferred pagination") but the PR also flips the default. Something like GenericTransfer: switch paginated mode to non-deferred default with opt-in deferral would surface that in the release notes.

3. Both test_non_deferred_paginated_read and test_deferred_paginated_read pass deferrable explicitly. A small test that omits the kwarg under default config and asserts the non-deferred branch is hit would lock in the contract.

The .pyi and "always-deferred behaviour" notes Copilot already raised look correctly addressed — not re-litigating.

Happy to take another look once the changelog entry is in.


This review was drafted by an AI-assisted tool and may contain mistakes. An Apache Airflow maintainer (@potiuk) has read and confirmed it before submission. See contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions for what counts as a maintainer review.

@dabla dabla changed the title Add support for non-deferred pagination mode in GenericTransfer GenericTransfer: switch paginated mode to non-deferred default with opt-in deferral Apr 28, 2026
@dabla
Copy link
Copy Markdown
Contributor Author

dabla commented Apr 30, 2026

@potiuk think all remarks have been addressed.

@dabla dabla requested a review from potiuk April 30, 2026 17:44
Comment thread providers/common/sql/docs/changelog.rst Outdated
Copy link
Copy Markdown
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Thanks for the changes — title, changelog, and default-config test all addressed. Approving. Three small nits inline as optional follow-ups; the version-heading comment from earlier still stands and should be dropped before merge (release manager assigns the version).


Drafted-by: Claude Opus 4.7; reviewed by @potiuk before posting

@dabla dabla requested a review from potiuk May 3, 2026 09:19
@dabla dabla merged commit a9c0f04 into apache:main May 4, 2026
99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants