Reputation: 35
I have a Python Flask app with integrated Cloudant running in Bluemix. The Cloudant database consists of a few documents. Each document has a "name" and an "email" field in addition to the default _id and rev field.
Using the CouchDB interface I can easily print out the addresses of the db field
doc in db:
docs +="<br>"+doc
gives the following result:
71076864699bfbd07b0f1684945e01ef _design/1e0c70cd2cad4211581be1c25adb1eea86d1b2f0 _design/3478963fd9207264b8ab48dbc23187ca9ad7204a
I now want to print out the actual values of the "name" and "email" fields. I can do that in the Cloudant UI with a Query or with an Index.
How do I run this Query or Index from my Python app to show the actual values of the name and email fields? What is the best practice?
Upvotes: 0
Views: 588
Reputation: 2078
This detailed Tutorial shows you how to do this.
You can also find the Cloudant Python Documentation here
Upvotes: 0
Reputation: 191
You'll need to make HTTP requests to the proper Cloudant endpoints using the credentials and URL for your Cloudant database that is provisioned for your application (found in the VCAP_SERVICES Environment Variable).
We have an alpha-stage python library, which we encourage you to use. It can do basic things at the moment and reduces the amount of boilerplate code you will need.
Upvotes: 1