My particular situation is that a group of classes can modify the query according to particular search situations. I only designed into the API to pass the query through the list of objects, not the query + the from_obj. Perhaps my usage is not very typical so I'm not suggesting any changes. I just was wondering if there is a better way than what I've come up with.
Perhaps a little better getter than the way I did it before might be: from_obj=[f for f in sel.froms][0] but again, I'm sure either way is really an intended usage. Thanks for everyone's input! -Dennis On Mar 6, 4:08 am, "hads" <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---