Uh oh!
There was an error while loading. Please reload this page.
Enable SQLAlchemy connection pool settings for file-based SQLite - #64888
Conversation
0d2ec20 to
539f56bCompareThere was a problem hiding this comment.
Pull request overview
This PR updates Airflow’s SQLAlchemy engine configuration so that connection pool settings are applied to file-based SQLite connections (matching SQLAlchemy 2.0+ defaults), while still skipping pool settings for in-memory SQLite connections where they are not supported.
Changes:
- Adjust
prepare_engine_argsto skip pool settings only for in-memory SQLite instead of all SQLite. - Update the SQLAlchemy docs link to the 2.0 documentation.
- Add unit tests to validate pool settings for file-based SQLite and skipping behavior for in-memory SQLite.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| airflow-core/src/airflow/settings.py | Refines pool-setting guard for SQLite and updates SQLAlchemy docs link. |
| airflow-core/tests/unit/core/test_sqlalchemy_config.py | Adds tests for file-based SQLite pooling and in-memory SQLite pool-setting skip behavior. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
539f56b to
985e49cCompareUh oh!
There was an error while loading. Please reload this page.
a40d548 to
7f22ef8Compare7f22ef8 to
2c27de6CompareUh oh!
There was an error while loading. Please reload this page.
jason810496
left a comment
There was a problem hiding this comment.
The only failing static check in CI was fixed in latest main, so I will merge it.
Hi maintainer, this PR was merged without a milestone set.
|
Backport successfully created: v3-2-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
… SQLite (apache#64888) * Enable SQLAlchemy connection pool settings for file-based SQLite * Fix review comments * Fix import make_url comment * Address Wei's final nit (cherry picked from commit d6ba3c4) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
… SQLite (#64888) (#65411) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Enable SQLAlchemy connection pool settings for file-based SQLite (#64888) * Enable SQLAlchemy connection pool settings for file-based SQLite * Fix review comments * Fix import make_url comment * Address Wei's final nit (cherry picked from commit d6ba3c4) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
… SQLite (#64888) (#65411) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Enable SQLAlchemy connection pool settings for file-based SQLite (#64888) * Enable SQLAlchemy connection pool settings for file-based SQLite * Fix review comments * Fix import make_url comment * Address Wei's final nit (cherry picked from commit d6ba3c4) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
… SQLite (#64888) (#65411) * [v3-2-test] Bump actions/github-script in the github-actions-updates group (#65150) (#65160) Bumps the github-actions-updates group with 1 update: [actions/github-script](https://github.com/actions/github-script). Updates `actions/github-script` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/actions/github-script/releases) - [Commits](actions/github-script@ed59741...3a2844b) (cherry picked from commit e5a047c) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [v3-2-test] Added breeze generate issue content for airflow-ctl (#65042) (#65241) * Add breeze generate issue content for airflow-ctl * add new command to doc (cherry picked from commit b24538b) Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> * [v3-2-test] Run release calendar verification on its own schedule (#65118) (#65242) * Move release calendar verification to its own scheduled workflow Run dev/verify_release_calendar.py from a dedicated daily scheduled workflow instead of as a canary job in the main CI pipeline, and notify the #release-management Slack channel when the check fails so the issue is surfaced to release managers directly. * Include wiki and calendar links in release calendar Slack alert (cherry picked from commit 048e9a1) * [v3-2-test] Enable SQLAlchemy connection pool settings for file-based SQLite (#64888) * Enable SQLAlchemy connection pool settings for file-based SQLite * Fix review comments * Fix import make_url comment * Address Wei's final nit (cherry picked from commit d6ba3c4) Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jarek Potiuk <jarek@potiuk.com> Co-authored-by: Justin Pakzad <114518232+justinpakzad@users.noreply.github.com> Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
Why
SQLAlchemy 2.0+ uses
QueuePoolby default for file-based SQLite databases, but Airflow unconditionally skips all pool configuration (pool_size,max_overflow,pool_recycle,pool_pre_ping) for any SQLite connection — a guard that was only correct for SQLAlchemy 1.x.What
not SQL_ALCHEMY_CONN.startswith("sqlite")guard inprepare_engine_argsand replace it with a targeted check that only skips pool settings for in-memory SQLite (sqlite://,sqlite:///:memory:), which usesSingletonThreadPoolthat doesn't supportmax_overflow.configure_orm.prepare_engine_argsdirectly, sinceconfigure_ormrejectssqlite:///:memory:as a relative path before reaching pool logic).