From 30020880d90ee2f983b8e6bfb1624349209dd8b0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 28 Mar 2008 15:55:26 +0000 Subject: - 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. --- lib/sqlalchemy/sql/expression.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') 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.""") -- cgit v1.2.1