]> 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:39 +0000 (13:44 -0400)
commit4aa43ecbd78e5a7dd3d983ca46a377af4e01877e
tree0e732b9e49ab686dce55b83b07d27c47e153d218
parentedf8e782cf5011cd43a0ee281b9e0b1d1becef1f
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
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