Thomas Drake wrote:
>
> Is there any way to use the case() expression with a query?

have you tried query.order_by(case(...)) ?


>
> On Oct 29, 2:26 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote:
>> ThomasDrakewrote:
>>
>> > Heyo,
>>
>> > Is there any way to specify a particular ordering on a column with the
>> > order by clause (or otherwise)? Something like:
>>
>> > session.query(People).order_by(People.name, ['rick', 'james', 'bob',
>> > 'mike'])
>>
>> I usually use a CASE expression for this.  somewhat tedious but gets the
>> job done.   SQLA has the `case()` function that renders CASE.
>>
>>
>>
>>
>>
>> > Thanks,
>>
>> > -thomas
> >
>


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