How do I look to see what sql is being constructed in the query
object?  So if I have something like:

q = query.session(User)
q = q.add_column(....)
q = q.group_by(.....).select()

How do I check what sql string has been constructed in q?

Also, say I want to do a group by a particular column name on the User
table and I have two aggregates, sum, and count?  How do I add these
two columns to q?  Do I just call add_column twice?  It's not working,
I'm getting an empty result set.

q = query.session(User)
q = q.add_column(func.sum(User.c.id).label('sum'))
q = q.add_column(func.count(User.c.id).label('count'))
q = q.group_by([User.c.blah]).select()

I'm getting an empty result set.  What exactly does label do here?

Thanks.


--~--~---------~--~----~------------~-------~--~----~
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