|
Project Information
Members
Featured
Downloads
Wiki pages
Links
|
CouchQL speeds up the creation of CouchDB views by automatically generating them based on a simple SQL like query. The following query will select all documents with a member 'x' whose value is greater than five. SELECT * FROM _ WHERE x > 5 An MD5 is calculated for the query an used to construct the name of the design document for the query. If CouchDB returns resource not found then the query is converted into Javascript, a design document posted to the server and the query rerun. Running a query over your CouchDB database is simple. If you have a CouchDB database object db then use the standard Python DB-API to run your query. c = db.cursor()
c.execute("SELECT * FROM _ WHERE x > %s", (5, ))
docs = c.fetchall()It is important to remember to use the automatic escaping of parameters otherwise you will see terrible performance. |