> > Well, earlier it was claimed that the DAL for SQLite left autocommit > on,
A quote from my earlier response: *web2py is just using the Python standard library sqlite3 module. According to the docs<http://docs.python.org/library/sqlite3.html#sqlite3-controlling-transactions>, it looks like it does not default to autocommit mode.* So now I have an extra place to go look and try to figure out, does > the DAL actually implement DBAPI with autocommit or does the DAL > implement DBAPI but with an exception re: autocommit? Having more > places to look is not 'ease of documentation' from a user's > perspective. :-/ > The DAL does not implement DBAPI at all. The DAL simply uses Python drivers for databases, and those drivers are supposed to implement the DBAPI specifications (and it looks like the SQLite driver does correctly implement the specification regarding autocommit). More importantly, it appears that autocommit is irrelevant to the issue at hand. > It matters if the query at the top of the loop holds a lock on the DB, > which means that when there are no rows found to process, the database > remains locked while the server is sleeping... > No, that's my point, it doesn't matter. The shared lock only lasts as long as it takes to read the records -- by the time it hits the for loop (even if the loop doesn't get entered due to no records), the shared lock is released. Whether or not autocommit is on shouldn't matter, so there's nothing in particular to document here that makes a difference for how to code a background task like this. As the docs say, when making changes to the db outside an HTTP request (e.g., in a background task script), do db.commit(). Other than that, nothing to worry about. Anthony --