summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-06-21 17:42:42 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-06-21 17:42:42 +0000
commit3c1a7710f0c1278a18ddeec28f3f67362fbc5ae7 (patch)
treeb00780a1b492b1d0c65cb18dbaf33ab72bb0fc08 /lib/sqlalchemy/sql.py
parenta1fe6e2c7607740c46eaab89e2bcd70aaccee71e (diff)
downloadsqlalchemy-3c1a7710f0c1278a18ddeec28f3f67362fbc5ae7.tar.gz
- added standalone distinct() function in addition to column.distinct()
[ticket:558]
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index f9ac753fa..92b51dd25 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -34,7 +34,7 @@ __all__ = ['AbstractDialect', 'Alias', 'ClauseElement', 'ClauseParameters',
'Compiled', 'CompoundSelect', 'Executor', 'FromClause', 'Join',
'Select', 'Selectable', 'TableClause', 'alias', 'and_', 'asc',
'between_', 'bindparam', 'case', 'cast', 'column', 'delete',
- 'desc', 'except_', 'except_all', 'exists', 'extract', 'func', 'modifier',
+ 'desc', 'distinct', 'except_', 'except_all', 'exists', 'extract', 'func', 'modifier',
'insert', 'intersect', 'intersect_all', 'join', 'literal',
'literal_column', 'not_', 'null', 'or_', 'outerjoin', 'select',
'subquery', 'table', 'text', 'union', 'union_all', 'update',]
@@ -375,6 +375,11 @@ def not_(clause):
return clause._negate()
+def distinct(expr):
+ """return a ``DISTINCT`` clause."""
+
+ return _UnaryExpression(expr, operator="DISTINCT")
+
def between(ctest, cleft, cright):
"""Return a ``BETWEEN`` predicate clause.
@@ -749,8 +754,11 @@ class _FunctionGenerator(object):
return _Function(self.__names[-1], packagenames=self.__names[0:-1], *c, **o)
func = _FunctionGenerator()
+
+# TODO: use UnaryExpression for this instead ?
modifier = _FunctionGenerator(group=False)
+
def _compound_select(keyword, *selects, **kwargs):
return CompoundSelect(keyword, *selects, **kwargs)