Ok. I need to do the following: select col1, col2, sum(col3), sum(col4) where col1 = "test" group by col1, col2
Q1: How do I add sum functions in the column list Q2: Do I add group_by using the group_by parameter on the sqlalchemy.select call Q3: Do I add where conditions to the select using statement.append_whereclause So from what you are saying I would do the following: select_columns = [table.c.col1, table.c.col2] statement = sqlalchemy.select(select_columns, group_by=select_columns) statement.append_whereclause(table.c.col1 == "test") res = statement.execute().fetchall() Thanks, VJ On Feb 20, 10:18 am, Sébastien LELONG <[EMAIL PROTECTED] securities.fr> wrote: > > select_columns = [table.c.col1, table.c.col2] > > > statement = table.select(select_columns) > > You probably want to: > > select_columns = [table.c.col1, table.c.col2] > statement = sqlalchemy.select(select_columns) > res = statement.execute().fetchall() # or the like... > > The "table.select" form you try to get working is used to specify eg. where > clauses, not to specify which columns to get. > > -- > Sébastien LELONG > sebastien.lelong[at]sirloon.net > > On Tuesday 20 February 2007 16:10, vinjvinj wrote: > > > I'm getting the following error when I build the select clause. > > > select_columns = [table.c.col1, table.c.col2] > > > statement = table.select(select_columns) > > File "build\bdist.win32\egg\sqlalchemy\sql.py", line 1351, in select > > File "build\bdist.win32\egg\sqlalchemy\sql.py", line 65, in select > > File "build\bdist.win32\egg\sqlalchemy\sql.py", line 1503, in > > __init__ > > File "build\bdist.win32\egg\sqlalchemy\sql.py", line 1575, in > > append_whereclause > > File "build\bdist.win32\egg\sqlalchemy\sql.py", line 1581, in > > _append_condition > > AttributeError: 'list' object has no attribute 'accept_visitor' > > > Any idea what this means? > > > VJ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---