anydbm safe for simultaneous writes?

chris chris.stromberger at gmail.com
Thu Feb 28 12:06:11 EST 2008


On Feb 28, 7:47 am, "Brian Smith" <br... at briansmith.org> wrote:
> Chris wrote:
> > I need simple data persistence for a cgi application that
> > will be used potentially by multiple clients simultaneously.
> > So I need something that can handle locking among writes.
> > Sqlite probably does this, but I am using Python 2.4.4, which
> > does not include sqlite.  The dbm-style modules would
> > probably be fine, but I have no idea if they are "write safe"
> > (I have no experience with the underlying unix stuff).  Any
> > tips appreciated.
>
> No, you cannot assume that this will work without locking. Locking is
> not trivial to do in Python. And, even with a working locking mechanism,
> you still have to invalidate the in-memory caches any time a write to
> the database is done. Futher, most dbm modules do not have ACID
> properties.
>
> I suggest intalling the pysqlite module and using it, regardless of your
> version of CPython. According to pysqlite developer, the version of
> pysqlite included in CPython 2.5 is old.
>
> - Brian

Thanks for the info.  In response to Dennis's question--the system is
controlled by a tyrannical system administrator, so I was hoping to
not have to ask him to install anything extra.  But it sounds like
sqlite (or mysql) is the way to go, so I will pursue that path.

Thanks,
Chris



More information about the Python-list mailing list