summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-16 22:38:18 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-16 22:38:18 +0000
commit811ece13974504685e1e2add7c91b2b88d213322 (patch)
tree04ca56f50aa99b85e29e0e546f37641674e94caf /lib/sqlalchemy/sql/expression.py
parent84c6857d214725246c28f97b4dba9d52385f9a37 (diff)
downloadsqlalchemy-811ece13974504685e1e2add7c91b2b88d213322.tar.gz
- The except_() method now renders as MINUS on Oracle,
which is more or less equivalent on that platform. [ticket:1712]
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r--lib/sqlalchemy/sql/expression.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 0b65cfa34..9bc127291 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -528,7 +528,7 @@ def union(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('UNION', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.UNION, *selects, **kwargs)
def union_all(*selects, **kwargs):
"""Return a ``UNION ALL`` of multiple selectables.
@@ -547,7 +547,7 @@ def union_all(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('UNION ALL', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.UNION_ALL, *selects, **kwargs)
def except_(*selects, **kwargs):
"""Return an ``EXCEPT`` of multiple selectables.
@@ -563,7 +563,7 @@ def except_(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('EXCEPT', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.EXCEPT, *selects, **kwargs)
def except_all(*selects, **kwargs):
"""Return an ``EXCEPT ALL`` of multiple selectables.
@@ -579,7 +579,7 @@ def except_all(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('EXCEPT ALL', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.EXCEPT_ALL, *selects, **kwargs)
def intersect(*selects, **kwargs):
"""Return an ``INTERSECT`` of multiple selectables.
@@ -595,7 +595,7 @@ def intersect(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('INTERSECT', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.INTERSECT, *selects, **kwargs)
def intersect_all(*selects, **kwargs):
"""Return an ``INTERSECT ALL`` of multiple selectables.
@@ -611,7 +611,7 @@ def intersect_all(*selects, **kwargs):
:func:`select`.
"""
- return _compound_select('INTERSECT ALL', *selects, **kwargs)
+ return CompoundSelect(CompoundSelect.INTERSECT_ALL, *selects, **kwargs)
def alias(selectable, alias=None):
"""Return an :class:`Alias` object.
@@ -904,8 +904,6 @@ def _cloned_intersection(a, b):
all_overlap = set(_expand_cloned(a)).intersection(_expand_cloned(b))
return set(elem for elem in a if all_overlap.intersection(elem._cloned_set))
-def _compound_select(keyword, *selects, **kwargs):
- return CompoundSelect(keyword, *selects, **kwargs)
def _is_literal(element):
return not isinstance(element, Visitable) and \
@@ -3459,6 +3457,13 @@ class CompoundSelect(_SelectBaseMixin, FromClause):
__visit_name__ = 'compound_select'
+ UNION = util.symbol('UNION')
+ UNION_ALL = util.symbol('UNION ALL')
+ EXCEPT = util.symbol('EXCEPT')
+ EXCEPT_ALL = util.symbol('EXCEPT ALL')
+ INTERSECT = util.symbol('INTERSECT')
+ INTERSECT_ALL = util.symbol('INTERSECT ALL')
+
def __init__(self, keyword, *selects, **kwargs):
self._should_correlate = kwargs.pop('correlate', False)
self.keyword = keyword