Oh, okay.

Thanks you.

On Nov 20, 5:23 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> the aggregate methods on Query, such as apply_sum(), apply_avg(),
> etc.,  are not in such great shape right now...they've been neglected
> and in fact aren't even working correctly with GROUP BY, etc...I've
> added trac ticket #876 for this.  If you know the exact SQL and
> columns you'd like to get back, typically its best just to issue that
> query without using an ORM construct.  your options for this are
> either just text:
>
> engine.execute("SELECT sum(amount), type from purchases group by
> type").fetchall()
>
> or the expression construct would look like:
>
> engine.execute(select([func.sum(Purchase.amount),
> Purchase.type]).group_by(Purchase.type)).fetchall()
>
> one important thing to be aware of is that SA has two distinct levels
> of SQL API; the ORM, which deals with Sessions and Query objects, and
> the SQL Expression Language, which deals with select(), update(),
> etc.  the expression language provides more direct access to SQL
> constructs.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to