Starting out with Desktop Couch

I’ve been playing with Python and Desktop Couch over the past few days, primarily as a learning exercise.

Why Desktop Couch? Well, there are a couple of reasons:

  1. I’m writing a command-line podcast catcher and one of the main things that annoys me about other podcast catchers is that I end up downloading the same stuff if I move from one machine to another. CouchDB’s replication can solve that.
  2. It seems more useful to learn to use Desktop Couch than to create my own file format to save my podcast catcher’s data.

What is Desktop Couch?

My understanding is that Desktop Couch is a project to make Apache’s CouchDB attractive to the developers of desktop applications, thereby giving those applications a common way of storing and replicating data.

Aq, one the people behind Desktop Couch, often gives the example of using a Couch database to store your web browser’s bookmarks. That way, if all your web browsers also speak to that database, you can share the bookmarks between them and, perhaps more interestingly, you can replicate your database to your other machines or the cloud and have your bookmarks on other computers, mobile devices, wherever.

Unlike SQL-based databases, CouchDB is not a relational database but a document-oriented database. A very simple relational database might have two tables:

  • Table 1: first_name, last_name, favourite_colour
  • Table 2: colour_name, rgb_hex_value, pantone_number

In table 1, favourite_colour would actually be a link to one of the entries in table 2.

In CouchDB, and other document-oriented databases such as Lotus Notes, you’d instead have a single document for each person that included all the info. So, no links elsewhere, just the info right there and then.

I’m no database expert but this is much simpler and, if you can get away with it, simple seems to be a good thing. I’ll leave it to other people to talk about why Desktop Couch, CouchDB and use of document-oriented databases are good ideas.

So, Desktop Couch provides a Python library that gives you access to Couch.

What I’m doing with Desktop Couch

I’m going to write here about my experience of writing a simple app that uses Desktop Couch. There’s not a great deal on the web, right now, about Desktop Couch so I’m hoping this will help me to work out what I’m doing and maybe provide a reference for others.

One thing to note, I’m pretty much learning Python at the same time and I’m not a developer, so I may write things that seem crazy or naive. Well, if I do, be kind :)