]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Turn FlushError for identity already exists into a warning.
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 May 2019 15:38:48 +0000 (11:38 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 May 2019 15:45:53 +0000 (11:45 -0400)
commit05bcd4c6eb600b0ab7866183315c05384575db64
treeba7acf33c1168acf14b01e59287dcbc6beede67d
parent1c3e92627362604472ca483055fc827a97942e6b
Turn FlushError for identity already exists into a warning.

The condition where a pending object being flushed with an identity that
already exists in the identity map has been adjusted to emit a warning,
rather than throw a :class:`.FlushError`. The rationale is so that the
flush will proceed and raise a :class:`.IntegrityError` instead, in the
same way as if the existing object were not present in the identity map
already.   This helps with schemes that are uinsg the
:class:`.IntegrityError` as a means of catching whether or not a row
already exists in the table.

Fixes: #4662
Change-Id: I9314550b7b03d7f376ef35518da7542e0f2f7cb6
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/4662.rst [new file with mode: 0644]
lib/sqlalchemy/orm/persistence.py
test/orm/test_events.py
test/orm/test_transaction.py