]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Warn for object replaced in identity map during flush
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Oct 2019 15:12:27 +0000 (11:12 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Oct 2019 17:44:48 +0000 (13:44 -0400)
commit61fa0e67cd590def361c3ede01b9f8cee5784b79
tree2dcd9df6659b47bd3340b74785059c25596bdd83
parent18a6f7c4f10a35c99636e5b48e8bb44b87817394
Warn for object replaced in identity map during flush

A warning is emitted for a condition in which the :class:`.Session` may
implicitly swap an object out of the identity map for another one with the
same primary key, detaching the old one, which can be an observed result of
load operations which occur within the :meth:`.SessionEvents.after_flush`
hook.  The warning is intended to notify the user that some special
condition has caused this to happen and that the previous object may not be
in the expected state.

Fixes: #4890
Change-Id: Ide11c6b9f21ca67ff5a96266c521d0c56fd6af8d
(cherry picked from commit 4aa43ecbd78e5a7dd3d983ca46a377af4e01877e)
doc/build/changelog/unreleased_13/4890.rst [new file with mode: 0644]
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/identity.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/orm/session.py
test/aaa_profiling/test_zoomark_orm.py
test/orm/test_naturalpks.py
test/orm/test_session.py