I have three tables a(a query of a really), b, c

a has a 1-many relationship with b
c has a 1-many relationship with b

What I would like to do is in my mapper for table c, is sort the order 
of rows from b by a.name.
I don't know how to do this or if it is possible. What I have looks like:

sql_a = select([table_a], table_a.c.col1='some value').alias('a_query')

mapper(B, b_table, properties = {
    'A' : relation(sql_a, lazy=False, 
primaryjoin=(sql_a.c.id==table_b.c.a_id))})

mapper(C, c_table, properties = {
    'Bs' : relation(B, backref='C', cascade='all, delete-orphan',
                      order_by=[C.A.name, c_table.c.value1, 
c_table.c.value2]),
    })

This gets me an "AttributeError: 'InstrumentedAttribute' object has no 
attribute 'name'"

I have also tried:
order_by=[A.name
and
order_by=[sql_a.c.name

both get me this: ProgrammingError: (ProgrammingError) missing 
FROM-clause entry for table "sql_a.name"




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