]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't raise w/ raiseload strategy for many-to-one history in flush
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 Nov 2019 15:27:02 +0000 (10:27 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 Nov 2019 16:16:32 +0000 (11:16 -0500)
commit2e6754ac0da5c1985485c8c075c6585bc6d1f00e
treedd73429d0c3eb7593069892b2204956b793cf581
parent8f1cbd8b6cfcabd52ecfa4f4f3d89728afb20f8f
Don't raise w/ raiseload strategy for many-to-one history in flush

Fixed issue involving ``lazy="raise"`` strategy where an ORM delete of an
object would raise for a simple "use-get" style many-to-one relationship
that had lazy="raise" configured.  This is inconsistent vs. the change
introduced in 1.3 as part of :ticket:`4353`, where it was established that
a history operation that does not expect emit SQL should bypass the
``lazy="raise"`` check, and instead effectively treat it as
``lazy="raise_on_sql"`` for this case.  The fix adjusts the lazy loader
strategy to not raise for the case where the lazy load was instructed that
it should not emit SQL if the object were not present.

Fixes: #4997
Change-Id: I4deb8c129900f28321c4a5c48301db5fe2aedf78
(cherry picked from commit ff4b63c2bc5f118d5ec1aacff06708dbc08a37a7)
doc/build/changelog/unreleased_13/4997.rst [new file with mode: 0644]
lib/sqlalchemy/orm/strategies.py
test/orm/test_relationships.py