Commits

jason kirtland committed 6f564ab

tweak DISTINCT precedence for clauses like `func.count(t.c.col.distinct())`

Comments (0)

Files changed (3)

 0.3.11
+- sql
+    - tweak DISTINCT precedence for clauses like
+      `func.count(t.c.col.distinct())`
 - orm
     - added a check for joining from A->B using join(), along two
       different m2m tables.  this raises an error in 0.3 but is 

lib/sqlalchemy/sql.py

     '>=':5,
     '<=':5,
     'BETWEEN':5,
+    'DISTINCT':5,
     'NOT':4,
     'AND':3,
     'OR':2,

test/sql/select.py

         self.runtest(
             select([distinct(table1.c.myid)]), "SELECT DISTINCT mytable.myid FROM mytable"
         )
+
+        self.runtest(
+            select([func.count(table1.c.myid.distinct())]), "SELECT count(DISTINCT mytable.myid) FROM mytable" 
+        ) 
+
+        self.runtest(
+            select([func.count(distinct(table1.c.myid))]), "SELECT count(DISTINCT mytable.myid) FROM mytable" 
+        )
         
     def testoperators(self):
         self.runtest(