CouchDB framework in Python

Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.

Couchdbkit goal is to provide a framework for your Python application to access and manage Couchdb.

Features

  • a full client always in sync with latest couchdb releases or trunk. Currently you can use full features of couchdb 0.9 and latest trunk
  • a client allowing you to use the http backend you want via py-restclient. Currently curl or httplib. You could also write your own, see transports documentation of py-restclient.
  • threadsafe
  • A system to attach design docs to your application and send them to CouchDB.
  • Manage documents with dynamic schema. Documents are completely dynamic

Getting started

CouchDB framework in Python

Couchdbkit provides you a full featured and easy client to access and manage CouchDB. It allows you to manage a CouchDB server, databases, doc managements and view access. All objects mostly reflect python objects for convenience. Server and Databases objects could be used for example as easy as using a dict.

from couchdbkit import Server

s = Server()

db = s.create_db("couchbdkit_test")
db['someid'] = { 'test': 'essai' }
doc = db['someid']

Map couchdb object to python object easily with dynamic schema. It's similar to ORMs but with all the couchdb awesomeness.

from couchdbkit import Document

class Greeting(Document):
    author = StringProperty()
    content = StringProperty()
    date = DateTimeProperty()
    
greet = Greeting()
greet.author = "Me"
greet.homepage = "http://couchdbkit.org"

Manage easily design docs in your Python application with loaders.

from couchdbkit.designer import pushapps

pushapps('/path/to/designs', db)

Next steps

Grab the code and you can read through the getting started tutorial. After you've gone through that, best thing to do is read the documentation on this site.

If you need help, don't hesitate to contact me.