commit() expires all data by default so that current information is available in the subsequent transaction - while I don't see the mentioned begin/commit() block or specific SQL logs in the example you gave, it appears likely that some access of the Squares objects themselves would incur a reload subsequent to the commit, but its impossible to say for sure without more detail.
docs and options regarding expire on commit at: http://www.sqlalchemy.org/docs/orm/session.html#committing http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.Session.commit On Feb 1, 2011, at 2:34 AM, Romy wrote: > Trying to figure out why my logs are showing a group of SELECT > statements after an update. I'm using Elixir on top of SQLA in the > following fashion: > > squares = > Squares.query.filter_by(user=user_record).all() > for sq in squares: > sq.sxsw_status = <value> > > elixir.session.flush() > return > > Nothing else uses the Squares table after that code. As soon as the > flush happens, I see the updates issued inside a begin/commit block, > followed by every one of those items re-SELECTed all over again. Why ? > This does not happen if I wrap the above block in an > elixir.session.begin() / commit() block. > > -- > 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. > -- 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.
