datamapper / do

DataObjects
147 stars 73 forks source link

Exposing busy_timeout to sqlite3 API #24

Closed atotic closed 12 years ago

atotic commented 12 years ago

Using datamapper and do_sqlite3 with multiple programs writing to the same db is impossible. The writes often fail with BusyError. I can work around it by using a different db, or hacking datamapper source to sleep/retry writes.

sqlite3 db engine has a built in 'retry on busy' function that fixes this problem: http://www.sqlite.org/c3ref/busy_timeout.html

do_sqlite3 does not expose this API. What do you think of using this in do_sqlite3?

There are several ways to do it:

PS: I would not use this setup in production, but it is useful for development. Love the simplicity of sqlite3 setup.