Jonathan LaCour wrote:

> pianoman wrote:
>
>> For example, I cannot seem to get a handle on creating
>> something equivalent to the likes of
>>
>> select max(ref_num) from document where ref_num < '9000'
>
> documents = Document.q.select(Document.c.ref_num < 9000)

Oops, so I misread what you are trying to do there by not
seeing the "max" part of the query.  Here is what you will
really want:

     from sqlalchemy import select, func

     max_rn = select(
         [func.max(Document.c.ref_num)],
         Document.c.ref_num < 9000
     ).execute().fetchone()[0]

That should do the trick for you.

--
Jonathan LaCour
http://cleverdevil.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to