]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
dont mutate bind_arguments incoming dictionary
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Oct 2022 15:25:08 +0000 (11:25 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Oct 2022 15:30:13 +0000 (11:30 -0400)
commit41df10db65ef5dfd5d04644e5f447908dad33cb8
tree61330efb81860e5c4a9fbc499e42151243897a9a
parentbe400435239644f9c51575dca9dbb409e08ceefc
dont mutate bind_arguments incoming dictionary

The :paramref:`_orm.Session.execute.bind_arguments` dictionary is no longer
mutated when passed to :meth:`_orm.Session.execute` and similar; instead,
it's copied to an internal dictionary for state changes. Among other
things, this fixes and issue where the "clause" passed to the
:meth:`_orm.Session.get_bind` method would be incorrectly referring to the
:class:`_sql.Select` construct used for the "fetch" synchronization
strategy, when the actual query being emitted was a :class:`_dml.Delete` or
:class:`_dml.Update`. This would interfere with recipes for "routing
sessions".

Fixes: #8614
Change-Id: I8d237449485c9bbf41db2b29a34b6136aa43b7bc
(cherry picked from commit 3efc9e1df378be8046d4b1f1b624968a62eb100f)
doc/build/changelog/unreleased_14/8614.rst [new file with mode: 0644]
lib/sqlalchemy/orm/session.py
test/orm/test_bind.py
test/orm/test_update_delete.py