0.7 has support for window functions. I haven't tried it in a subquery.
http://www.sqlalchemy.org/docs/core/tutorial.html?highlight=window#window-functions
--
Mike Conley
On Wed, Jul 27, 2011 at 9:16 AM, Eduardo ruche...@googlemail.com wrote:
I have the following statement :
SELECT name, id, division, value,
FROM (
SELECT name, id, division,value, max(value) over
(partition by division) as max_val
FROM tab1
)
WHERE value = max_val
I try to turn this sql statement into a Query object
I tried this
sqlquery=session.query(sometab)
sqlquery.statement= SQL QUERY GIVEN ABOVE
but it does not work because statement cannot be set directly.
What is get-around for this?
Can this statement be written as a subquery? If yes, how? I saw
several example of subqueries on the internet but none of these seem
to be suitable for this statement.
Thanking in advance
Eddie
--
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.