[storm] Store.find() and GROUP BY ORDER BY

Jamu Kakar jamshed.kakar at canonical.com
Wed Sep 12 07:06:30 BST 2007


Hi Vsevolod,

Vsevolod Balashov wrote:
 > But I have no way I can get a list of objects using the GROUP BY and
 > ORDER BY expressions. Only tuple of unicode strings using
 > Store.execute(Select(...)).

Group-by support is coming, we know it's missing; this isn't an
oversight, but more of a "we haven't had time/strong enough need for
it yet". :)

Order-by is well supported.  You need to call the order_by [1] method
on the ResultSet you get from Store.find.  For example, to get a list
of Person's ordered by name you could do:

result = store.find(Person)
result.order_by(Person.name)
for person in result:
     # Process ordered Persons.

Hope this helps!

Thanks,
J.

[1] 
http://twistedmatrix.com/users/radix/storm-api/storm.store.ResultSet.html#order_by



More information about the storm mailing list