Skip to content
Permalink
Browse files

Support SQL min().

  • Loading branch information
cyrusdaboo committed Jan 17, 2014
1 parent e15bf8c commit 9a4aea4d9820dffa0254f519968f9c9769e2d99a
Showing with 13 additions and 1 deletion.
  1. +1 −0 twext/enterprise/dal/syntax.py
  2. +12 −1 twext/enterprise/dal/test/test_sqlsyntax.py
@@ -600,6 +600,7 @@ def __call__(self, *args):
Count = Function("count")
Sum = Function("sum")
Max = Function("max")
Min = Function("min")
Len = Function("character_length", "length")
Upper = Function("upper")
Lower = Function("lower")
@@ -29,7 +29,7 @@ def addSQLToSchema(*args, **kwargs):
raise SkipTest("addSQLToSchema is not available: {0}".format(e))
from twext.enterprise.dal.syntax import (
Select, Insert, Update, Delete, Lock, SQLFragment,
TableMismatch, Parameter, Max, Len, NotEnoughValues,
TableMismatch, Parameter, Max, Min, Len, NotEnoughValues,
Savepoint, RollbackToSavepoint, ReleaseSavepoint, SavepointAction,
Union, Intersect, Except, SetExpression, DALError,
ResultAliasSyntax, Count, QueryGenerator, ALL_COLUMNS,
@@ -1019,6 +1019,17 @@ def test_max(self):
)


def test_min(self):
"""
L{Min}C{(column)} produces an object in the C{columns} clause that
renders the C{min} aggregate in SQL.
"""
self.assertEquals(
Select([Min(self.schema.BOZ.QUX)], From=self.schema.BOZ).toSQL(),
SQLFragment("select min(QUX) from BOZ")
)


def test_countAllCoumns(self):
"""
L{Count}C{(ALL_COLUMNS)} produces an object in the C{columns} clause

0 comments on commit 9a4aea4

Please sign in to comment.
You can’t perform that action at this time.