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

Paul Rubin http
Fri May 27 18:52:15 EDT 2005


Peter Hansen <peter at engcorp.com> writes:
> 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...

Compared to what the OP was asking for, which was a way to synchronize
appending to a serial log file, SQlite is very complex.  It's also
much more complex than (say) the dbm module, which is what Python apps
normally use as a lightweight db.

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

Oh ok, it says it uses some special locking system calls on Windows.
Since those calls aren't in the Python stdlib, it must be using C
extensions, which again means complexity.  But it looks like the
built-in msvcrt module has ways to lock parts of files in Windows.

Really, I think the Python library is somewhat lacking in not
providing a simple, unified interface for doing stuff like this.



More information about the Python-list mailing list