summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-03-28 15:55:26 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-03-28 15:55:26 +0000
commit30020880d90ee2f983b8e6bfb1624349209dd8b0 (patch)
treebf99fd27fd4e1b6d5c8f13639bdefa64aa223967 /lib/sqlalchemy/sql
parent784ff76cef903d2a826c9eba0c38db0158d414c5 (diff)
downloadsqlalchemy-30020880d90ee2f983b8e6bfb1624349209dd8b0.tar.gz
- can now allow selects which correlate all FROM clauses
and have no FROM themselves. These are typically used in a scalar context, i.e. SELECT x, (SELECT x WHERE y) FROM table. Requires explicit correlate() call.
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/expression.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index a3a25f573..f4611de6d 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -3088,14 +3088,12 @@ class Select(_SelectBaseMixin, FromClause):
for f in froms:
froms.difference_update(f._hide_froms)
- if len(froms) > 1:
+ if len(froms) > 1 or self.__correlate:
if self.__correlate:
froms.difference_update(self.__correlate)
if self._should_correlate and existing_froms is not None:
froms.difference_update(existing_froms)
- if not froms:
- raise exceptions.InvalidRequestError("Select statement '%s' is overcorrelated; returned no 'from' clauses" % str(self.__dont_correlate()))
return froms
froms = property(_get_display_froms, doc="""Return a list of all FromClause elements which will be applied to the FROM clause of the resulting statement.""")