On 4/27/2010 5:22 AM, jo wrote:
Hi all,In version 0.6 seems the group_by property does nothing... (Pdb) sql = select([Verifica.c.codice,func.sum(Prestazione.c.importo).label('importo')]) (Pdb) print sql SELECT verifica.codice, sum(prestazione.importo) AS importo FROM verifica, prestazione (Pdb) sql.group_by(Verifica.c.codice) <sqlalchemy.sql.expression.Select at 0x706b6d0; Select object> (Pdb) print sql SELECT verifica.codice, sum(prestazione.importo) AS importo FROM verifica, prestazione (Pdb) I expected a query like this: SELECT verifica.codice, sum(prestazione.importo) AS importo FROM verifica, prestazione GROUP BY verifica.codice How it works in 0.6?
I believe the group_by() method will return a new selectable instead of changing your current one in-place. So perhaps try: sql_grouped = sql.group_by(Verifica.c.codice) print sql_grouped Lance -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
