On Apr 18, 2007, at 12:21 AM, Chris Shenton wrote:

>
> I'm using SQLAlchemy with Pylons and query my 'system' table and order
> by their client_id field like:
>
>   from er.models import System, Vendor, Client
>   sys = self.session.query(System).select(System.c.lastseen >  
> self.this_week,
>                                           order_by= 
> [System.c.client_id,
>                                                      
> System.c.lastseen])
>

it would look like:

        query(System).select(System.c.lastseen > self.this.week, from_obj= 
[system_table.join(client)], order_by=[client.c.name])

or alternatively

        query(System).select(and_(System.c.lastseen > self.this.week,  
system_table.c.client_id==client.c.client_id), order_by=[client.c.name])

i.e. you arent doing any kind of "column selection" here, you just  
need the cols to be in the order by.

there is a way to get extra columns in the "SELECT" clause of a  
mapper query in the most recent version of SA but thats not what  
youre looking for here.



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