SQLite doesn't have support for SELECT..FOR UPDATE, and with_lockmode() 
ultimately has no impact when using SQLite as nothing is rendered.   SQLite's 
concurrency model is based on a lock of the entire database file - hardly a row 
lock - I wouldn't think such a strategy applies on that backend ?


On Apr 27, 2011, at 1:02 AM, Clay Gerrard wrote:

> 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 transaction')" before doing
> the select.
> 
> This seems to work for now, but it feels like cheating.  Better way to
> do this?
> 
> -clayg
> 
> -- 
> 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.

Reply via email to