summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-04-10 13:25:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-04-10 14:36:16 -0400
commit86c43d2e0f0c7c28b933f470678571077c5d5035 (patch)
tree82c09614ed7abda55a3c1d56e5d7eadbbc3647b4 /lib/sqlalchemy
parent93b11905e599a6d73a85d2085e15385ebf46cdc6 (diff)
downloadsqlalchemy-86c43d2e0f0c7c28b933f470678571077c5d5035.tar.gz
Compare entities also on chop_path
When comparing query._current_path to options, the path chop was not taking into account that the query or the options are against aliased classes that don't match the mapper. The issue does not seem to take place for the Load() version of _chop_path. Fixed bug to improve upon the specificity of loader options that take effect subsequent to the lazy load of a related entity, so that the loader options will match to an aliased or non-aliased entity more specifically if those options include entity information. Fixes: #3963 Change-Id: Ifdff37d579042fcc62bdeabce9e2413e9a03fbba
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/strategy_options.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/strategy_options.py b/lib/sqlalchemy/orm/strategy_options.py
index bae2b73e2..60ed2be30 100644
--- a/lib/sqlalchemy/orm/strategy_options.py
+++ b/lib/sqlalchemy/orm/strategy_options.py
@@ -376,7 +376,8 @@ class _UnboundLoad(Load):
_WILDCARD_TOKEN,) and c_token != p_prop.key:
return None
elif isinstance(c_token, PropComparator):
- if c_token.property is not p_prop:
+ if c_token.property is not p_prop or \
+ c_token._parententity is not p_mapper:
return None
else:
i += 1