diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-25 23:22:30 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-25 23:27:49 -0500 |
| commit | f8914288f012c4ef635531f09a0e13bcacacdb2a (patch) | |
| tree | 1755633fd4d8e977e95f4d1fe87c39f9b60f85e4 /lib/sqlalchemy | |
| parent | eff7b4f29d2a98ef4ccd95b693c7d653eaa543eb (diff) | |
| download | sqlalchemy-f8914288f012c4ef635531f09a0e13bcacacdb2a.tar.gz | |
- An improvement to the workings of :meth:`.Query.correlate` such
that when a "polymorphic" entity is used which represents a straight
join of several tables, the statement will ensure that all the
tables within the join are part of what's correlating.
fixes #3662
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index ad7b9130b..f68a30917 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -882,12 +882,15 @@ class Query(object): a subquery as returned by :meth:`.Query.subquery` is embedded in another :func:`~.expression.select` construct. - """ + """ - self._correlate = self._correlate.union( - _interpret_as_from(s) - if s is not None else None - for s in args) + for s in args: + if s is None: + self._correlate = self._correlate.union([None]) + else: + self._correlate = self._correlate.union( + sql_util.surface_selectables(_interpret_as_from(s)) + ) @_generative() def autoflush(self, setting): |
