write to the same file from multiple processes at the same time?

Peter Hansen peter at engcorp.com
Fri May 27 18:33:44 EDT 2005


Paul Rubin wrote:
> Peter Hansen <peter at engcorp.com> writes:
> 
>>And PySQLite conveniently wraps the relevant calls with retries when
>>the database is "locked" by the writing process, making it roughly a
>>no-brainer to use SQLite databases as nice simple log files where
>>you're trying to write from multiple CGI processes like the OP wanted.
> 
> Oh, ok.  But what kind of locks does it use?  

I think the FAQ can answer that better than I can, since I'm not sure 
whether you're asking about any low-level (OS) locks it might use or 
higher-level (e.g. database-level locking) that it might use.  In 
summary, however, at the database level it provides only coarse-grained 
locking on the entire database.  It *is* supposed to be a relatively 
simple/lightweight solution compared to typical RDBMSes...

(There's also an excrutiating level of detail about this whole area in 
the page at http://www.sqlite.org/lockingv3.html ).

-Peter



More information about the Python-list mailing list