I made some changes for this, in rev 1904. you can now use the from_obj keyword parameter to Query.select(), and it wont step on the tables you put in there:
r = query.select(mytable.c.id==10, from_obj=[mytable.join (myothertable)]) you can put whatever x.join(y).outerjoin(z) type of thing into the from_obj list. if the main mapped table is in there, then it will use that as the only instance of that table in the FROM clause. for the DSL-like behavior, you have to use the SelectResults plugin to Query, since thats the official "DSL" home base. this can be used explicitly or can be invoked automatically for mappers that use the SelectResultsExt plugin (or you can specify SelectResultsExt globally too). from sqlalchemy.ext.selectresults import SelectResults query = SelectResults(session.query(MyClass)) result = query.join_to('prop1').outerjoin_to('prop2').filter (mytable.c.crit=='some criterion') you can also use "from_obj" with SelectResults via the select_from method: result = query.select_from([table1.join(table2).join(table3)]).filter (<criterion>) if you play with these a little bit that would be good, to get some feedback before i document these and put them in a release. the existing join_to and join_via have already been released too long for me to change their behavior, which is one reason i chose to put the DSL version into SelectResults (and also almost nothing else in Query works in a transformative way like that so it would be inconsistent). On Sep 26, 2006, at 5:32 PM, Dennis Muhlestein wrote: > On 9/26/06, Michael Bayer <[EMAIL PROTECTED]> wrote: >> ok, so im thinking the join_to/join_via could be more DSLish and work >> like this: >> >> query.join_to('x').outerjoin_to('y').join_to('z') etc... >> >> right now there is a from_obj parameter to Query. but it >> unconditionally adds the mapper's table to it, so its hard to create >> specific joins to that table. ill remove that extra table add if >> theres one in there already. i added ticket 315 for this with a >> description of what needs to be done. > > We're on the same page. if query's join interface worked like the > table.join(table).outerjoin(etc) syntax, that I think would solve the > problem. > > -Dennis ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users