Mark,
On 11/03/2011 07:18 PM, Mark Erbaugh wrote:
Using the query object count() method generates a sub-query (as per the docs).
The docs say to use func.count to avoid the subquery. func.count seems to
require a field object. Is there a way to generate a query that essentially
becomes 'select count(*) from table' using the ORM, not the SQL generator?
Just the other day I thought I needed the same, initially I just used
the "id" column which all my tables had, but as count(anything) is
pretty expensive (using Firebird SQL - so might be different for other
dbs) I wanted to find a way without using count(). In my case I needed
at some point to get all the "id" values of that table (to build a
virtual listctrl in wxPython), so instead of doing the count and
starting feeling the list I got the "id" and did a len(onresult) to get
my count.
Point I am trying to make with a lot of words, maybe there is a solution
which doesn't need count() at all:-) .
Werner
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.