views:

201

answers:

6

I am looking for a small database that can be "embedded" into my Python application without running a separate server, as one can do with SQLite or Metakit. I don't need an SQL database, in fact storing free-form data like Python dictionaries or JSON is preferable.

The other requirement is that to be able to run an instance of the database on a server, and have instances of my application (clients) sync the database with the server (two-way), similar to what CouchDB replication can do.

Is there a database that will do this?

A: 

HSQLDB does this, but unfortunately it's Java rather than Python.

Firebird SQL might be closer to what you want, since it does seem to have a Python interface.

kwatford
I don't think firebird comes with synchronization yet, can you point to a URL that shows otherwise?
Alex Martelli
+1  A: 

If you don't need an SQL database, what's wrong with CouchDB? You can spawn a local process to serve the DB, and you could easily write a server wrapper to allow only access from your app. I'm not sure about the access story, but I believe the latest Ubuntu uses CouchDB for synchronizeable user-level data.

Barry Wark
The only problem with CouchDB is dependencies and size. My application is windows/linux/osx, the installers for CouchDB are twice the size of the app itself.
dF
The entire Erlang VM, which is required is a potentially large install, I agree. CouchDB itself is actually pretty svelte. However, I don't think you're going to find anything that fits all your requirements without a large dependency; synchronization is hard.
Barry Wark
It seems that if I want the to use fancy sync features of couchdb, and not roll my own, I really need to require couchdb!
dF
+1  A: 

Seems like the perfect job for CouchDB: 2 way sync is incredibly easy, schema-less JSON documents are the native format. If you're using python, couchdb-python is a great way to work with CouchDB.

dnolen
Yes except for the dependency on erlang, which makes including couchdb prohibitively large. Erlang seems to have compilers to native code, is it possible to make a smaller CouchDB package that way?
dF
+1  A: 

Do you need clients to work offline and then resync when they reconnect to the network? I don't know if MongoDB can handle the offline client scenario, but if the client is online all the time, MongoDB might be a good solution too. It has pretty goode python support. Still a separate process, but perhaps easier to get running on Windows than CouchDB.

Barry Wark
+2  A: 

From what you describe, it sounds like you could get by using pickle and FTP.

Robert Rossney
+1  A: 

BerkeleyDB might be another option to check out, and it's lightweight enough. easy_install bsddb3 if you need a Python interface.

Pydroid