diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-10-11 14:45:24 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-10-16 13:33:01 -0400 |
commit | 33119301bb3efa143ebaaef22a7b5170f14a1331 (patch) | |
tree | 3097d7db5f2defabad7792539a8048f3c95c5c0c /lib/sqlalchemy/orm/loading.py | |
parent | 657ec85e8733c64b9be2154c3169d31c15a06dce (diff) | |
download | sqlalchemy-33119301bb3efa143ebaaef22a7b5170f14a1331.tar.gz |
Implement raiseload for deferred columns
Added "raiseload" feature for ORM mapped columns.
As part of this change, the behavior of "deferred" is now more strict;
an attribute that is set up as "deferred" at the mapper level no longer
participates in an "unexpire" operation; that is, when an unexpire loads
all the expired columns of an object which are not themselves in a deferred
group, those which are mapper-level deferred will never be loaded.
Deferral options set at query time should always be reset by an expiration
operation.
Renames deferred_scalar_loader to expired_attribute_loader
Unfortunately we can't have raiseload() do this because it would break
existing wildcard behavior.
Fixes: #4826
Change-Id: I30d9a30236e0b69134e4094fb7c1ad2267f089d1
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r-- | lib/sqlalchemy/orm/loading.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index 106ea7985..8de7d5a8b 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -21,6 +21,7 @@ from . import exc as orm_exc from . import path_registry from . import strategy_options from .base import _DEFER_FOR_STATE +from .base import _RAISE_FOR_STATE from .base import _SET_DEFERRED_EXPIRED from .util import _none_set from .util import aliased @@ -384,6 +385,8 @@ def _instance_processor( # searching in the result to see if the column might # be present in some unexpected way. populators["expire"].append((prop.key, False)) + elif col is _RAISE_FOR_STATE: + populators["new"].append((prop.key, prop._raise_column_loader)) else: getter = None # the "adapter" can be here via different paths, |