CouchDB in desktop applications

Following my last post I was considering writing a Venus filter which adds all feed items into a CouchDB database. This could then be queried by a modified wxVenus or a  webapp (using the CouchDB jQuery library) or whatever.

Thinking specifically about wxVenus, which is a desktop appliaction, CouchDB is like MySQL in that you must have the server up and running before your application tries to use it, and (afaik) there is no way to embed the server itself into your application, which places quite a bit of burden on the user.

My initial plans were to use SQLite which I can embed and use happily without another daemon running beforehand, but would mean I have to set up a schema and do all that tedious INSERTing, SELECTing and so on (I appreciate I could go all ORM on its ass, but again the development effort is much much higher than that with CouchDB).

So, what to do? I suspect that for the moment I’ll go about getting CouchDB all nice and integrated, but it doesn’t look like it’d leave me with an application people can download, install the dependencies, and just run, does it?

Storing feedparser objects in couchdb

sudo apt-get install python-feedparser
easy_install jsonpickle
sudo apt-get install couchdb
easy_install couchdb
sudo couchdb

Open a new terminal

python
import feedparser, jsonpickle
from couchdb import Server
s = Server('http://127.0.0.1:5984/')
len(s)
db = s.create('feeds')
len(s)
doc = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml")
doc['feed']['title']
len(doc.feed.links)
pfeed = jsonpickle.encode(doc)
db.create({'feed1' : pfeed})

outputs DOC_ID

cfeed = db['DOC_ID_HERE']
dfeed = jsonpickle.decode(cfeed['feed1'])
dfeed['feed']['title']
len(dfeed.feed.links)