3 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Generative group_by ...| From | Sent On | Attachments |
|---|---|---|
| Curtis Scheer | 24 Aug 2007 07:42 | |
| Michael Bayer | 24 Aug 2007 17:13 | |
| Curtis Scheer | 28 Aug 2007 15:28 |
| Subject: | [sqlalchemy] Re: Generative group_by query specify columns![]() |
|---|---|
| From: | Curtis Scheer (Cur...@DAYCOS.com) |
| Date: | 08/28/2007 03:28:09 PM |
| List: | com.googlegroups.sqlalchemy |
So why is it possible do a query.group_by() but not a possible to specify the columns to select as execution of the query fails in postgresql because it is trying to select all the columns of table "Foo" in this instance.
Or is their some way of combining the sql.select() module with the query module?
_____
From: Michael Bayer [mailto:mike...@zzzcomputing.com] Sent: Friday, August 24, 2007 7:14 PM To: sqla...@googlegroups.com Subject: [sqlalchemy] Re: Generative group_by query specify columns
On Aug 24, 2007, at 10:43 AM, Curtis Scheer wrote:
What is the syntax to specify the columns in a generative query?
q = session.query(Foo)
q = q.group_by([foo_table.c.description])
for currow in q:
print currow
This query selects all the columns in the Foo table, wondering how to specify the columns to select.
query(Foo) will always select all columns that correspond to a "Foo" object. for individual columns, use a SQL expression instead of a Query, i.e. select([foo_table.c.cola, foo_table.c.colb]).group_by(...).where(...).<etc>() .
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




