On Mar 6, 10:38 am, "Dennis" <[EMAIL PROTECTED]> wrote: > I'm playing around with dynamically building a query. I can append > columns, where clauses, from objects etc... but what about the case > where I want to modify the from obj with a join? > > For example I can do this: > > sel=select() > sel.append_from(a) > sel.append_from(b) > sel.append_whereclause(a.c.id==b.c.id) > > That won't work for an outerjoin though. I have a query that works > like this now: > > select ( [...], from_obj=[a.outerjoin(b)] ) > > but I can't figure out a way to add the outerjoin dynamically. I > looked at clause visitors but there doesn't seem like a way to > actually modify an existing join. > > Any thoughts?
I've just been playing with this the other day. Here's the gist of what I'm using; from_obj = a.outerjoin(b) from_obj = from_obj.outerjoin(c) select(select_fields, where_fields, from_obj=[from_obj]).execute() hads --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---