fix: move PoolKey to utils/pool_key so the async provider can share it - #1272
Merged
Conversation
sophia-bq
reviewed
Aug 21, 2026
sophia-bq
approved these changes
Aug 24, 2026
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.
Description
Moves
PoolKeyout ofsql_alchemy_connection_provider.pyinto a new dependency-free module,aws_advanced_python_wrapper/utils/pool_key.py.AsyncPooledConnectionProviderkeys its internal pools with the samePoolKeyas the sync provider, but it previously had to reach intosql_alchemy_connection_providerto get it. That module importssqlalchemyat module scope, and SQLAlchemy is a dev-only dependency of this package — so importing the async pooled connection provider pulled in SQLAlchemy and would raiseModuleNotFoundErrorfor anyone using the async internal connection pool without SQLAlchemy installed. The async pooled provider itself has no use for SQLAlchemy; it manages its own async pools.PoolKeyis a two-field cache key (url,extra_key) with no pool-implementation dependencies, so the new module imports nothing beyondtyping. Both providers now import it from the canonical location, and the class itself is unchanged — this is a pure move plus import updates, with no behavior change.The relocation also drops the re-export shims that briefly stood in for the old import paths.
PoolKeyis an internal cache key: it is not exported fromaws_advanced_python_wrapper/__init__.py, is not referenced anywhere indocs/, and is not part of the documented public API, so aliases in the two provider modules only advertise a second and third place the class appears to live. Note thatfrom aws_advanced_python_wrapper.sql_alchemy_connection_provider import PoolKeystill resolves regardless, since that module imports the name for its own use — anyone who reached for the old path keeps working without a documented alias.Changes
aws_advanced_python_wrapper/utils/pool_key.pyholdingPoolKey, with a module docstring explaining why it stands alone.sql_alchemy_connection_provider.py: importPoolKeyfrom the new module; drop the class definition and the trailing__all__block (the sync modules in this package do not otherwise declare__all__).aio/pooled_connection_provider.py: importPoolKeyfrom the new module instead of from the SQLAlchemy provider, and drop it from__all__.test_pool_key.py,test_sql_alchemy_pooled_connection_provider.py, andtest_aio_pooled_connection_provider.pyimportPoolKeyfrom the canonical path.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.