]> 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:32:24 +0000 (11:32 -0400)
commit6bf32f56e28d14f6ba15517dea34a87d37bbe644
tree7311e93f7b9daf4225c36feded310c0af8b27eaf
parent231897cf10d731c6bab4bca562374c60558a0177
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
doc/build/changelog/unreleased_14/8614.rst [new file with mode: 0644]
lib/sqlalchemy/orm/bulk_persistence.py
lib/sqlalchemy/orm/session.py
test/orm/dml/test_update_delete_where.py
test/orm/test_bind.py