With the SQL layer: update(foo_tbl, not_(foo_tbl.c.explanation.in_(select ([turnover_tbl.c.reason], whereclause=and_(turnover_tbl.c.datasource == 'blah', turnover_tbl.c.turnover == 0) ))), values={'turnover': 1})
With the ORM layer: sess.query(Foo).filter(~Foo.explanation.in_( sess.query(Turnover.reason).filter_by(datasource='blah', turnover=0) )).update({'turnover': 1}) On Aug 28, 11:47 pm, Victor Ng <crankyco...@gmail.com> wrote: > I can't seem to figure out how to tell sqlalchemy to do something > like : > > UPDATE Foo > SET turnover = 1 > WHERE EXPLANATION NOT IN(SELECT Reason FROM mbsIsTurnoverXLAT where > Datasource ='blah' and Isturnover=0) > AND DATASOURCE = 'blah' > > The "not in" clause is the part that's tripping me up. I'm not sure > how to express that using the query api with raw Table objects. --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---