summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-03-06 02:27:13 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-03-06 02:27:13 +0000
commita0079b6831aef2b604859f89f07772e65c04d5d4 (patch)
treee70475a71ecc1cc198f8a7dd70f17fb081fb9727 /lib/sqlalchemy/sql.py
parent51acad4b5bf4ec5517d66e111d625ac0a0fd443e (diff)
downloadsqlalchemy-a0079b6831aef2b604859f89f07772e65c04d5d4.tar.gz
added new 'polymorphic' example. still trying to understand it :) .
fixes to relation to enable it to locate "direction" more consistently with inheritance relationships more tweaks to parenthesizing subqueries, unions, etc.
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index d4d059d6a..a6ddf8cb9 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -454,7 +454,7 @@ class CompareMixin(object):
# assume *other is a list of selects.
# so put them in a UNION. if theres only one, you just get one SELECT
# statement out of it.
- return self._compare('IN', union(*other))
+ return self._compare('IN', union(parens=True, *other))
def startswith(self, other):
return self._compare('LIKE', str(other) + "%")
def endswith(self, other):
@@ -1123,6 +1123,7 @@ class CompoundSelect(SelectBaseMixin, FromClause):
self.keyword = keyword
self.selects = selects
self.use_labels = kwargs.pop('use_labels', False)
+ self.parens = kwargs.pop('parens', False)
self.oid_column = selects[0].oid_column
for s in self.selects:
s.group_by(None)
@@ -1209,7 +1210,8 @@ class Select(SelectBaseMixin, FromClause):
def visit_compound_select(self, cs):
self.visit_select(cs)
for s in cs.selects:
- s.useparens = False
+ s.parens = False
+ print "BUT", id(cs), cs.parens
def visit_column(self, c):pass
def visit_table(self, c):pass
def visit_select(self, select):
@@ -1217,7 +1219,7 @@ class Select(SelectBaseMixin, FromClause):
return
select.is_where = self.is_where
select.issubquery = True
- select.useparens = True
+ select.parens = True
if getattr(select, '_correlated', None) is None:
select._correlated = self.select._froms