Table T has a self referential parent_id column. 'parent' is an
orm.relation using that column.

I have the following code which obviously does not work

myquery = T.query()
myquery = myquery.outerjoin('parent', aliased=True)
myquery = myquery.reset_joinpoint()
myquery = myquery.order_by(func.if_(T.c.parent_id==None, T.c.name,
T.c.name))

With the 'reset_joinpoint' call, both T.c.name's in the last line will
refer to the first
instance of T. Without that call, both will refer to the joined
instance (will use the alias).

What I want is the first T.c.name in the if_() expression to refer to
the first table instance, and the second T.c.name  to refer to the
joined table instance. I.e. the second T.c.name only should use the
alias.

How do I make that work?




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

Reply via email to