tags:

views:

491

answers:

3

I'm starting to experiment with CouchDB because it looks like the perfect solution for certain problems we have. Given that all work will be on a brand new project with no legacy dependencies, which client library would you suggest that I use, and why?

This would be easier if there was any overlap on the OSes we use. FreeBSD only has py-simplecouchdb already available in its ports collection, but that library's project website says to use CouchDBKit instead. Neither of those come with Ubuntu, which only ships with CouchDB. Since those two OSes don't have an libraries in common, I'll probably be installing something from source (and hopefully submitting packages to the Ubuntu and FreeBSD folks if I have time).

For those interested, I'd like to use CouchDB as a convenient intermediate storage place for data passed between various services - think of a message bus system but with less formality. For example, we have daemons that download and parse web pages, then send interesting bits to other daemons for further processing. A lot of those objects are ill-defined until runtime ("here's some HTML, plus a set of metadata, and some actions to run on it"). Rather than serialize it to an ad-hoc local network protocol or stick it in PostgreSQL, I'd much rather use something designed for the purpose. We're currently using NetWorkSpaces in this role, but it doesn't have nearly the breadth of support or the user community of CouchDB.

+2  A: 

I have been using couchdb-python with quite a lot of success and as far as I know the guys of desktopcouch use it in ubuntu. The prerequisites are very basic and you should have not problems:

  • httplib2
  • simplejson or cjson
  • Python
  • CouchDB 0.9.x (earlier or later versions are unlikely to work as the interface is still changing)

For me some of the advantages are:

  • Pythonic interface. You can work with the database like if it was a dict.
  • Interface for design documents.
  • a CouchDB view server that allows writing view functions in Python

It also provides a couple of command-line tools:

  • couchdb-dump: Writes a snapshot of a CouchDB database
  • couchdb-load: Reads a MIME multipart file as generated by couchdb-dump and loads all the documents, attachments, and design documents into a CouchDB database.
  • couchdb-replicate: Can be used as an update-notification script to trigger replication between databases when data is changed.
mandel
Thanks! That's just the kind of opinion I was looking for.
Just Some Guy
A: 

Considering the task you are trying to solve (distributed task processing) you should consider using one of the many tools designed for message passing rather than using a database. See for instance this SO question on running multiple tasks over many machines.

If you really want a simple casual message passing system, I recommend you shift your focus to MorbidQ. As you get more serious, use RabbitMQ or ActiveMQ. This way you reduce the latency in your system and avoid having many clients polling a database (and thus hammering that computer).

I've found that avoiding databases is a good idea (That's my blog) - and I have a end-to-end live data system running using MorbidQ here

Tom Leys
I see the point you're making, but for the sake of the question, assume I've done due diligence and that it's an appropriate answer for our needs. As I mentioned, it's replacing NetWorkSpaces which is significantly less featureful than any of the options you or I have listed.
Just Some Guy
Fair enough - I personally went a long way down the path of using databases to essentially do message passing before I realised that there were much better options outside of databases.
Tom Leys
A: 

If you're still considering CouchDB then I'll recommend Couchdbkit (http://www.couchdbkit.org). It's simple enough to quickly get a hang on and runs fine on my machine running Karmic Koala. Prior to that I've tried couchdb-python but some bugs (maybe ironed out by now) with httplib was giving me some errors (duplicate documents..etc) but Couchdbkit got me up and going so far without any problems.

Pydroid
I haven't committed to any client yet, so thanks for the input!
Just Some Guy