Python choice of database

Philippe C. Martin philippe at philippecmartin.com
Mon Jun 20 15:40:45 EDT 2005


Yes, I agree, but as most of the customer base I target uses the O/S that
cannot be named ;-) , file names could become a problem just as 'ln -s' is
out of the question.

Yet, this might be the best trade-off.

Regards,

Philippe



Oren Tirosh wrote:

> Philippe C. Martin wrote:
>> Hi,
>>
>> I am looking for a stand-alone (not client/server) database solution for
>> Python.
>>
>> 1) speed is not an issue
>> 2) I wish to store less than 5000 records
>> 3) each record should not be larger than 16K
> 
> How about using the filesystem as a database? For the number of records
> you describe it may work surprisingly well. A bonus is that the
> database is easy to manage manually. One tricky point is updating: you
> probably want to create a temporary file and then use os.rename to
> replace a record in one atomic operation.
> 
> For very short keys and record (e.g. email addresses) you can use
> symbolic links instead of files. The advantage is that you have a
> single system call (readlink) to retrieve the contents of a link. No
> need to open, read and close.
> 
> This works only on posix systems, of course. The actual performance
> depends on your filesystem but on linux and BSDs I find that
> performance easily rivals that of berkeleydb and initialization time is
> much faster. This "database" also supports reliable concurrent access
> by multiple threads or processes.
> 
> See http://www.tothink.com/python/linkdb
> 
> Oren




More information about the Python-list mailing list