From 105810c92123c74b0066ef01db5d1696932800c6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 8 Oct 2019 16:42:21 -0400 Subject: Omit onclause as source of FROMs from a Join The :class:`.Join` construct no longer considers the "onclause" as a source of additional FROM objects to be omitted from the FROM list of an enclosing :class:`.Select` object as standalone FROM objects. This applies to an ON clause that includes a reference to another FROM object outside the JOIN; while this is usually not correct from a SQL perspective, it's also incorrect for it to be omitted, and the behavioral change makes the :class:`.Select` / :class:`.Join` behave a bit more intuitively. Fixes: #4621 Change-Id: Iaa1e75b7c59b21e9701ab3c9b69e66930feaf8ee --- lib/sqlalchemy/sql/selectable.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 6282cf2ee..6a7413fc0 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -1157,12 +1157,7 @@ class Join(FromClause): @property def _from_objects(self): - return ( - [self] - + self.onclause._from_objects - + self.left._from_objects - + self.right._from_objects - ) + return [self] + self.left._from_objects + self.right._from_objects # FromClause -> -- cgit v1.2.1