You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by mo...@gmail.com on 2008/12/15 22:05:17 UTC

help regarding couchdb python view server

how do we write couchdb map reduce queries in python.

i have searched extensively but unable to find a good doc

Please point me to solutions
i hope this leads to not writing queries in js
Thanks

-- 
Gpirate the top torrent search engine
http://gpirate.com

Re: help regarding couchdb python view server

Posted by Adam Kocoloski <ad...@gmail.com>.
On Dec 15, 2008, at 4:05 PM, mobiledreamers@gmail.com wrote:

> how do we write couchdb map reduce queries in python.
>
> i have searched extensively but unable to find a good doc
>
> Please point me to solutions
> i hope this leads to not writing queries in js
> Thanks

Hi, hopefully this helps to get you started ...

Step 1: Install the couchdb-python library.  You can get it using  
"easy_install couchdb" or by installing from the Google Code source (http://code.google.com/p/couchdb-python/ 
)

Step 2: You should now have a "couchpy" script in your Python scripts  
directory (e.g. /usr/local/bin).  That's the Python view server.  Now  
you need to tell CouchDB to use that view server for design documents  
written in Python.  You do this by adding the following to ${PREFIX}/ 
etc/couchdb/local.ini:

[query_servers]
python = /path/to/couchpy

If you like, you can use the runtime configuration ability of CouchDB  
to send this information to the server:

curl -X PUT http://localhost:5984/_config/query_servers/python -d '"/ 
path/to/couchpy"'

Step 3: Make sure your design doc specifies "language":"python"

Step 4: The syntax for a python view looks like

def mapfun(doc):
     yield doc["somekey"], doc["somevalue"]

def reducefun(keys, values, rereduce):
     return sum(values)

Regards, Adam





help regarding couchdb python view server

Posted by mo...@gmail.com.
how do we write couchdb map reduce queries in python.

i have searched extensively but unable to find a good doc

Please point me to solutions
i hope this leads to not writing queries in js
Thanks

-- 
Gpirate the top torrent search engine
http://gpirate.com



-- 
Gpirate the top torrent search engine
http://gpirate.com