I am having trouble what is best practice when using SQLalchemy to
issue a select with a count(*) and a group by.

Example SQL: select type, count(*) as type_count from type_tbl group
by type

This gives me the following result set:

+-------+-----------------+
| type  | type_count |
+-------+-----------------+
| test1 |               5 |
| test2 |               3 |
+-------+-----------------+

Does i need to do some setup in my mapper to facilitate this cleanly?
Or is this something that can be done right from the .query() object?
Been trying different things I've found searching on here, like
incorporating .distinct() with .count() but can't seem to get the
result I am looking for.

Not, right now, I am just using a select to get an array of the value,
but I assume there must be a way to do this at a high level in the
orm?

Thanks,

Wayne

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to