Many thanks to Jan Lehnardt for helping me out via IM to understand some concepts that I was having problems wrapping my mind around.
Rallyhat is for the most part a programming experiment for me, designed to learn Python *and* produce an web application that is actually usable by someone other than me. One of the technologies I’m using is CouchDB to store things. I was having some problems getting both couchdb-python working with permanent views (meaning views stored in CouchDB itself) as opposed to temporary views (meaning views generated in the code).
Now, couchdb-python looks to be a nice, simple interface to use. The problem I found was the documentation is, what’s the word I’m looking for? Lacking. Since Jan is an amazing teacher, he was patient with me and showed me that I could look at the documentation for couchdb-python via the Python REPL (aka the Python shell). So, armed with this “how the hell could I not realize this” knowledge I figured out how to use it. Yet another reason why I’m warming up to Python.
It was as simple as starting up the Python shell and then doing the following:
1
2
So, task #1 was to create the view I needed. I decided to use Futon, the built-in interface to create my permanent view:
1
2
3
4
5
6
7
8
9
This view would then live at http://couchdb.server//rallyhat/_design/searches/_view/by_user is you want to get every doc for every user. To get just the docs belong to a specific user, you append ?key=
1
2
3
4
5
6
7
8
9
10
11
12
With *any* Python library that you use, make sure to see if the author added help files to the package. You’d be surprised to see what’s in there…