On Apr 2, 2008, at 10:20 PM, kris wrote:
> > > >> query.join() is only intended for relations(). To join on tables >> directly use query.select_from(table1.join(table2, >> onclause)).filter(..)...etc. >> >> - mike > > > Now that query(TYPE).select_from is deprecated, is there a preferred > form? I dont see what's deprecated there, assuming you mean sess.query(MyClass).select_from()... > I actually need to something like the follow > subquery = session.query(ATYPE).filter_by (...) > > session.query(BTYPE).select_from ( subquery).filter_by > (subquery.c.col_id == BTYPE.c.id) if you're selecting BTYPEs, using the subquery in the filter will handle the sticking it in the FROM for you. sess.query(BTYPE).filter(subquery.c.col_id==BTYPE.c.id) "select_from" means, "this is where we are getting the rows to be returned from". other things in the FROM clause get added there automatically. Its the same idea as if you said: select([table.c.col1]).where(table.c.col2==5) the "FROM" clause of the select statement is implicit, since its obvious that we are selecting from "table". --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
