[sqlalchemy] Re: sqlite transaction isolation, select for update, race condition

2011-04-27 Thread Clay Gerrard
On Apr 27, 10:41 am, Michael Bayer wrote: > > then yes, for your case this is exactly the pysqlite bug Daniel mentions:   > http://code.google.com/p/pysqlite/issues/detail?id=21.  Pysqlite doesn't open > the transaction until DML is encountered specifically to reduce file locks.   > This shoul

[sqlalchemy] Re: sqlite transaction isolation, select for update, race condition

2011-04-27 Thread Clay Gerrard
On Apr 27, 9:37 am, Daniel Holth wrote: > Is this pysqlite issue about SELECT not starting a transaction > related?http://code.google.com/p/pysqlite/issues/detail?id=21 Hrmmm... well... that's interesting... it might be related, but maybe not? I'm not setting the isolation level when I create

[sqlalchemy] Re: sqlite transaction isolation, select for update, race condition

2011-04-27 Thread Clay Gerrard
On Apr 27, 9:19 am, Michael Bayer wrote: > SQLite doesn't have support for SELECT..FOR UPDATE, and with_lockmode() > ultimately has no impact when using SQLite as nothing is rendered.   IDK why sqlite doesn't support a way to elevate the lock on a select in the middle of a deferred transaction

[sqlalchemy] sqlite transaction isolation, select for update, race condition

2011-04-27 Thread Clay Gerrard
Yesterday I was working with some code that needed a "select ... for update" concept to avoid a race condition. Adding .with_lockmode('update') works a treat on InnoDB and Postgres, but for sqlite I end up having to sneak in a "if session.bind.name == 'sqlite'; session.execute('begin immediate tran