diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-18 10:34:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-18 10:34:59 -0400 |
| commit | e5d0592180a554a1220985d28dab8533030281f0 (patch) | |
| tree | 4da2cbd57e944ef884ca3a8f8342420d88c52636 /lib/sqlalchemy/orm | |
| parent | f14ec0f517eaf6956962d2d0a34dacb69bead46b (diff) | |
| download | sqlalchemy-e5d0592180a554a1220985d28dab8533030281f0.tar.gz | |
- additional test + correction for [ticket:2699]
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/strategies.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index e08bb40cb..0eed50ea4 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -778,11 +778,12 @@ class SubqueryLoader(AbstractRelationshipLoader): # to look only for significant columns q = orig_query._clone().correlate(None) - # TODO: why does polymporphic etc. require hardcoding - # into _adapt_col_list ? Does query.add_columns(...) work - # with polymorphic loading ? - if entity_mapper.isa(leftmost_mapper): + # 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 entity_mapper.isa(leftmost_mapper): q._set_select_from(entity_mapper) + + # select from the identity columns of the outer q._set_entities(q._adapt_col_list(leftmost_attr)) if q._order_by is False: |
