I was going to mention the "count" function off of Table as well as just using func.count, but I guess its the DISTINCT youre looking for ? with the DISTINCT, the closest you can get is:

        select([func.count("distinct column")], from_obj=[table])

however, I just added a "distinct" function on columns so if you get SVN 1171 or greater, you can do:

        select ([func.count(mytable.c.col1.distinct())])

or just off the function:

        func.count(t.c.col1.distinct()).select()


On Mar 19, 2006, at 10:50 AM, sifu wrote:

hi!

is there a another way to to the following query with sqlalchemy?
SELECT COUNT( DISTINCT somecol ) from sometable

at the moment i do:
select( [ "COUNT( DISTINCT somecol )" ], from_obj = [ sometable ] )

thank you,
sifu


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to