diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2017-01-19 16:28:58 -0500 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@awstats.zzzcomputing.com> | 2017-01-19 16:28:58 -0500 |
| commit | 81518ae2e2bc622f8cd47287a575ad4c0e43ead1 (patch) | |
| tree | 8ba287eb1b7911b45888544d871a38864e765238 /lib | |
| parent | 42027de3fce1d4ce2e3a684c59ee87f440b51ae8 (diff) | |
| parent | 4ae02f46e944ac11af5ad77e5ff5f06963b63b3d (diff) | |
| download | sqlalchemy-81518ae2e2bc622f8cd47287a575ad4c0e43ead1.tar.gz | |
Merge "Dont set _set_select_from() for alias object"
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/strategies.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index 4e3574b54..ffd47d17d 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -851,11 +851,14 @@ class SubqueryLoader(AbstractRelationshipLoader): # set a real "from" if not present, as this is more # accurate than just going off of the column expression - if not q._from_obj and orig_entity.mapper.isa(leftmost_mapper): + if not q._from_obj and orig_entity.is_mapper and \ + orig_entity.mapper.isa(leftmost_mapper): q._set_select_from([orig_entity], False) target_cols = q._adapt_col_list(leftmost_attr) - # select from the identity columns of the outer + # select from the identity columns of the outer. This will remove + # other columns from the query that might suggest the right entity + # which is why we try to _set_select_from above. q._set_entities(target_cols) distinct_target_key = leftmost_relationship.distinct_target_key |
