Newbie: Proper database for the task?

David LeBlanc whisper at oz.net
Wed Dec 25 17:42:13 EST 2002


I highly recommend SQLite and PySQLite compared to gadfly or bsddb. It's
fast, compact and has better features IMO. Although it shares the
"everything is a string" philosopy of the others, it does have the ability
to use an integer primary key and it's use is essentially transparent. It's
license is public domain and it's actively maintained.

www.sqlite.org

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Paul Mackinney
> Sent: Tuesday, December 24, 2002 12:54
> To: Python Users
> Subject: Newbie: Proper database for the task?
>
>
> Hi, I'm writing a database to track a Maildir whose message filenames
> are sequential integers padded to uniform length. The structure that
> I've adopted is to a database whose keys are integers (corresponding to
> the filenames) and whose values are dictionaries of a set of message
> properties. For example,
>
> db[234] = {'name':'Eric Idle','email':'parrot at itsonlysleeping.com'}
>
> All of the database modules seem to use strings for keys and values, but
> I don't want to call str() and eval() all the time. I want to use the
> fact that my records are ordered to optimize searches & relative
> lookups.
>
> Bsddb's record number format supports integer keys, but only string
> values. Shelve's BsdDBShelf module lets me store pickleable (non-string)
> values, but doesn't work with a bsddb.rnopen() object and the other
> bsddb formats use keys that are strings.
>
> To keep my project moving I've written a db class that uses integer
> keys, pickleable values, and has all of the dbm and bsddb methods, but
> it really feels like a hack. Surely this problem has an existing
> solution? (And yes, I've thought of using an SQL database. Users with
> large datasets will need this but I'd like to have a solution in python
> for small to moderate datasets.)
>
> TIA, PM
> --
> Paul Mackinney
> paul at mackinney.net
>
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list