summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/interfaces.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-10-11 14:45:24 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-10-16 13:33:01 -0400
commit33119301bb3efa143ebaaef22a7b5170f14a1331 (patch)
tree3097d7db5f2defabad7792539a8048f3c95c5c0c /lib/sqlalchemy/orm/interfaces.py
parent657ec85e8733c64b9be2154c3169d31c15a06dce (diff)
downloadsqlalchemy-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/interfaces.py')
-rw-r--r--lib/sqlalchemy/orm/interfaces.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 09d1858b9..abb6b14cc 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -538,9 +538,10 @@ class StrategizedProperty(MapperProperty):
return self._strategies[key]
except KeyError:
cls = self._strategy_lookup(self, *key)
- self._strategies[key] = self._strategies[cls] = strategy = cls(
- self, key
- )
+ # this previosuly was setting self._strategies[cls], that's
+ # a bad idea; should use strategy key at all times because every
+ # strategy has multiple keys at this point
+ self._strategies[key] = strategy = cls(self, key)
return strategy
def setup(self, context, query_entity, path, adapter, **kwargs):