Re: [sqlalchemy] group_by by the result of some other query

2011-08-11 Thread Andrew Taumoefolau
Hi Eduardo, group_by accepts strings, so this is certainly possible. You might do it like so: # build our column names query column_names = session.query(tab.c.name).filter(tab.c.value==354) # execute and a build a list of strings from our query column_names = [column_name for (column_name,) in

[sqlalchemy] group_by by the result of some other query

2011-08-10 Thread Eduardo
Dear all, I am trying to find a way to limit group_by arguments of one query only to the values of some other query. Is this doable? If yes how to do that. This is an example how query looks like: query1.group_by(sesion.query(tab.columns['name']).filter(datab.columns['value']==354).all()) Thanks