Hi.

I find the use of asc and desc functions not very flexible.

I have implemented these functions:


from sqlalchemy import sql

def orderBy(table, colum, direction):
     return sql._CompoundClause(None, table.c[column], direction.upper())

def buildOrderList(table, order=[]):
         return [
           orderBy(table, column, direction)
            for column, direction in order
            ]


As an example:

buildOrderList(usernames, [('username', 'asc')])


In this way I can use strings where possible.



Manlio Perillo






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