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 column_names] # group the results of query1 by the list of column names we just created query1 = query1.group_by(*column_names) Cheers, Andrew Taumoefolau andrew.taumoefo...@gmail.com On 11/08/2011, at 2:43 AM, Eduardo wrote: > 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 > > -- > 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 > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.