[sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Kent
By design, when a query() fetches an existing object, it doesn't refresh the values unless populate_existing() is included with the query. The documentation for populate_existing() states it isn't meant for general purpose. Occasionally, however, objects need to be selected FOR UPDATE,

Re: [sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Michael Bayer
populate_existing() blows away any pending changes on the object so turning it on by default would be a surprise in a lot of cases. typically if someone is working with FOR UPDATE they're already programming a very specific section in a very careful manner, it's not something that's done

Re: [sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Kent
I had forgotten the danger of populate_existing() also because we make it automatically issue a flush() for these purposes. Documentation note sounds good. On 3/5/2013 10:45 AM, Michael Bayer wrote: populate_existing() blows away any pending changes on the object so turning it on by default