summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2018-09-19 09:30:34 -0400
committerGerrit Code Review <gerrit@ci.zzzcomputing.com>2018-09-19 09:30:34 -0400
commit95094d3789a558b310782c27a33b95dddb092dfc (patch)
tree4be48d63f4bac6c52c86c2ef5c77d261c8399734 /lib/sqlalchemy/orm
parent5981e4328193bd760c4e2b28fdb8451f0f55c4ea (diff)
parent43f2c66ea7413cc0aaf6ca040ad33fb65ca4412d (diff)
downloadsqlalchemy-95094d3789a558b310782c27a33b95dddb092dfc.tar.gz
Merge "Adapt right side in join if lateral detected"
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/query.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py
index 627a4e01c..7e7c93527 100644
--- a/lib/sqlalchemy/orm/query.py
+++ b/lib/sqlalchemy/orm/query.py
@@ -542,6 +542,7 @@ class Query(object):
if with_labels:
q = q.with_labels()
q = q.statement
+
if reduce_columns:
q = q.reduce_columns()
return q.alias(name=name)
@@ -2381,6 +2382,12 @@ class Query(object):
need_adapter = False
+ if r_info.is_clause_element and right_selectable._is_lateral:
+ # orm_only is disabled to suit the case where we have to
+ # adapt an explicit correlate(Entity) - the select() loses
+ # the ORM-ness in this case right now, ideally it would not
+ right = self._adapt_clause(right, True, False)
+
if right_mapper and right is right_selectable:
if not right_selectable.is_derived_from(
right_mapper.mapped_table):