]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
ensure pool.reset event always called for reset
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Oct 2022 20:00:50 +0000 (16:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 30 Oct 2022 19:43:19 +0000 (15:43 -0400)
commitb4261c45ab5861e86eb26cc08510fb114db0ec12
tree5d8276d879c5a6b5226c40158ff00e1e2e572d57
parentf21f84d47d708211ee32b1ad2ca70bf9fa2d8e96
ensure pool.reset event always called for reset

Added new parameter :paramref:`.PoolEvents.reset.reset_state` parameter to
the :meth:`.PoolEvents.reset` event, with deprecation logic in place that
will continue to accept event hooks using the previous set of arguments.
This indicates various state information about how the reset is taking
place and is used to allow custom reset schemes to take place with full
context given.

Within this change a fix that's also backported to 1.4 is included which
re-enables the :meth:`.PoolEvents.reset` event to continue to take place
under all circumstances, including when :class:`.Connection` has already
"reset" the connection.

The two changes together allow custom reset schemes to be implemented using
the :meth:`.PoolEvents.reset` event, instead of the
:meth:`.PoolEvents.checkin` event (which continues to function as it always
has).

Change-Id: Ie17c4f55d02beb6f570b9de6b3044baffa7d6df6
Fixes: #8717
18 files changed:
doc/build/changelog/unreleased_14/8717.rst [new file with mode: 0644]
doc/build/changelog/unreleased_20/8717.rst [new file with mode: 0644]
doc/build/core/events.rst
doc/build/core/pooling.rst
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/create.py
lib/sqlalchemy/event/legacy.py
lib/sqlalchemy/events.py
lib/sqlalchemy/pool/__init__.py
lib/sqlalchemy/pool/base.py
lib/sqlalchemy/pool/events.py
test/engine/test_deprecations.py
test/engine/test_logging.py
test/engine/test_pool.py
test/profiles.txt