when using count().
- postgres:
- better reflection of sequences for alternate-schema Tables [ticket:442]
- sequences on a non-pk column will properly fire off on INSERT
-
+- ext:
+ - added distinct() method to SelectResults. generally should only make a difference
+ when using count().
+
0.3.4
- general:
- global "insure"->"ensure" change. in US english "insure" is actually
"""apply an OFFSET to the query."""
return self[offset:]
+ def distinct(self):
+ """applies a DISTINCT to the query"""
+ new = self.clone()
+ new._ops['distinct'] = True
+ return new
+
def list(self):
"""return the results represented by this SelectResults as a list.
filters = [q.join_to('employees'),
Employee.c.name.startswith('J')]
- d = SelectResults(q, and_(*filters), ops=dict(distinct=True))
+ d = SelectResults(q)
+ d = d.join_to('employees').filter(Employee.c.name.startswith('J'))
+ d = d.distinct()
d = d.order_by([desc(Department.c.name)])
assert d.count() == 2
assert d[0] is d2