Hi Thanks for the answer,
This is my query
column_names = session.query(tab.c.name).filter(tab.c.value==354)
column_names = [column_name for (column_name,) in column_names]
query=sess.query(func.max(tab.columns['name']),datab.columns['article_id']).group_by(*column_names).all()

I get an error here:

ProgrammingError: (ProgrammingError) syntax error at or near ".6"
LINE 2: ... GROUP BY fde.ck1.LKUT.RAT-ES.vertic.6hpa.low.6hdfjks.rih

What does this mean?
Thanks
                                                ^
 'SELECT max(sometable.name) AS max_1, sometable.id AS sometable_id
\nFROM sometable GROUP BY fde.ck1.LKUT.RAT-ES.vertic.6hpa.low.
6hdfjks.rihfjkdp1.fhsdjk00-1900.nhgtec,.....

On Aug 11, 7:34 am, Andrew Taumoefolau <zen...@gmail.com> wrote:
> Hi Eduardo,
>
> group_by accepts strings, so this is certainly possible. You might do it like 
> so:
>
> # build our column names query
>
> # execute and a build a list of strings from our query
>
> # 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 
> > athttp://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.

Reply via email to