best small database?

Pierre Quentel quentel.pierre at wanadoo.fr
Mon Sep 11 15:38:48 EDT 2006


Here are some pure-Python databases :
- gadfly : an SQL engine, mature and well tested, works in memory so
not fit for large data sets
- SnakeSQL : another SQL engine, less mature I think and very slow when
I tested it
- KirbyBase : stores data in a single file ; uses a more Pythonic
syntax (no SQL) ; no size limit but performance decreases very much
with the size. It looked promising but the last version is more than 1
year old and the author seems to focus on the Ruby version now
- buzhug : Pythonic syntax (uses list comprehensions or methods like
create(), select() on the db object), much faster than all the above.
I'm obviously biaised : I wrote it...
- for a small set of data you could also try strakell, the recipe I
published on the Python Cookbook :
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496770
With less than 200 lines of code, it's a very fast in-memory db
engine that also uses list comprehensions for requests :

    SQL : SELECT name FROM persons WHERE age > 20
    strakell :  [ r["name"] for r in persons if r["age"] > 20 ]

You can also create an index : persons.create_index("age")
and then use it like this : persons.age[20] = list of the records where
age = 20

Other pure-Python databases : ZODB (probably overkill for a small
database) and Durus (I didn't test it)

As said in others answers, the inclusion of SQLite in the standard
distribution might make pure-Python solutions less attractive

Regards,
Pierre




More information about the Python-list mailing list