Repository navigation
fix: import on SQLAlchemy 2.1, which removed FallbackAsyncAdaptedQueuePool - #79
Merged
Merged
Conversation
…ePool Register fallback_async_adapted_queue only when sqlalchemy.pool still has the class (SQLAlchemy 2.0). On 2.1 the kit imports, the other built-in pools resolve as before, and the removed name raises the registry's ValueError. A CI job now runs the whole suite on the newest SQLAlchemy that pyproject.toml allows. Fixes #78
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #78.
import sqlalchemy_foundation_kitfailed on SQLAlchemy 2.1, which the metadata (sqlalchemy[asyncio]>=2.0.35,<3.0.0) lets every fresh install pick:base/engine.pyimportedFallbackAsyncAdaptedQueuePool, and SQLAlchemy 2.1 removed it together with theasync_fallbackmode it served.Change
base/engine.pyregistersfallback_async_adapted_queueonly whensqlalchemy.poolstill has the class (SQLAlchemy 2.0). On 2.1 the kit imports, the five other built-ins resolve as before, and resolvingfallback_async_adapted_queueraises the registry's usualValueErrorwith the list of available pools. Nothing changes on SQLAlchemy 2.0.sqlalchemy.pool, the way 2.1 looks to the kit. It fails on master with theImportErrorfrom the issue and passes with the change.All tests (newest SQLAlchemy), that runsuv lock --upgrade-package sqlalchemyand the whole suite, so the next SQLAlchemy release that breaks the kit shows up in CI rather than in a user's install. It is part ofAll checks passed.uv.lockstays on 2.0.49, so the existing jobs keep testing 2.0.docs/agents.mdand thePoolSettingsdocstring say thatfallback_async_adapted_queueexists only on SQLAlchemy 2.0.Checks run locally
uv run ruff check .,uv run ruff format --check .,uv run mypy sqlalchemy_foundation_kit: clean;pre-commiton the changed files: passed.ImportError: cannot import name 'FallbackAsyncAdaptedQueuePool' from 'sqlalchemy.pool'; with the change it passes.uv run pytest --cov=sqlalchemy_foundation_kit --cov-fail-under=90): 665 passed, coverage 94.24%.uv run --with "sqlalchemy[asyncio]==2.1.6" pytest, integration tests onpostgres:17-alpineincluded): 662 passed, 3 skipped. The three skipped tests are the ones that exerciseFallbackAsyncAdaptedQueuePoolitself.uv lock --upgrade-package sqlalchemy, the new CI job's first step, resolves 2.1.6 (uv.lockwas restored afterwards and is not part of this change).