From 04861dfd0e75e6fff3aa730bcad27f3172ae2fd8 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 25 Feb 2021 23:20:05 -0500 Subject: disable all raiseload within the unit of work process. The unit of work process now turns off all "lazy='raise'" behavior altogether when a flush is proceeding. While there are areas where the UOW is sometimes loading things that aren't ultimately needed, the lazy="raise" strategy is not helpful here as the user often does not have much control or visibility into the flush process. Fixes: #5984 Change-Id: I23f2e332a5faa5c7c29823c9be9434d129676a5a --- lib/sqlalchemy/orm/unitofwork.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/orm/unitofwork.py') diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index c293d90cb..1fb1c10ac 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -254,7 +254,9 @@ class UOWTransaction(object): history = impl.get_history( state, state.dict, - attributes.PASSIVE_OFF | attributes.LOAD_AGAINST_COMMITTED, + attributes.PASSIVE_OFF + | attributes.LOAD_AGAINST_COMMITTED + | attributes.NO_RAISE, ) if history and impl.uses_objects: state_history = history.as_state() @@ -266,7 +268,11 @@ class UOWTransaction(object): # TODO: store the history as (state, object) tuples # so we don't have to keep converting here history = impl.get_history( - state, state.dict, passive | attributes.LOAD_AGAINST_COMMITTED + state, + state.dict, + passive + | attributes.LOAD_AGAINST_COMMITTED + | attributes.NO_RAISE, ) if history and impl.uses_objects: state_history = history.as_state() -- cgit v1.2.1