summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-26 14:53:45 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-26 15:04:07 -0500
commit29e033f496c28e4d7b9a5bfc46096711f0aa5571 (patch)
treebc9f3e1fa7ff0b9df9082406a4a4dc9e3b5d5dbc /lib/sqlalchemy
parentecbaa44582ab85def3fb500361b219581fab5d95 (diff)
downloadsqlalchemy-29e033f496c28e4d7b9a5bfc46096711f0aa5571.tar.gz
Ensure of_type subclass taken into account with wildcards
Fixed a regression in 1.2 where a wildcard/load_only loader option would not work correctly against a loader path where of_type() were used to limit to a particular subclass. The fix only works for of_type() of a simple subclass so far, not a with_polymorphic entity which will be addressed in a separate issue; it is unlikely this latter case was working previously. Since we ensure that the entity is broken out into its superclasses when a wilcard is encountered, we can limit the entity path to the specific entity given in this case. Within this issue some additional issues with with_polymorphic() loaders were found which will be addressed in #4469. Fixes: #4468 Change-Id: Ie91ec27b49104e019636f870776e294321586a9e
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index 19c81860e..ee3b83caa 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -203,6 +203,13 @@ class Load(Generative, MapperOption):
self.propagate_to_loaders = False
if wildcard_key:
attr = "%s:%s" % (wildcard_key, attr)
+
+ # TODO: AliasedInsp inside the path for of_type is not
+ # working for a with_polymorphic entity because the
+ # relationship loaders don't render the with_poly into the
+ # path. See #4469 which will try to improve this
+ if existing_of_type and not existing_of_type.is_aliased_class:
+ path = path.parent[existing_of_type]
path = path.token(attr)
self.path = path
return path
@@ -706,7 +713,6 @@ class _UnboundLoad(Load):
if not loader.is_class_strategy:
for idx, token in enumerate(start_path):
-
if not loader._generate_path(
loader.path,
token,