cloudant / python-cloudant

A Python library for Cloudant and CouchDB
Apache License 2.0
163 stars 55 forks source link

How to work with same library from python Notebook in watson studio ? #367

Closed ZaheerUdDeen closed 6 years ago

emlaver commented 6 years ago

Hi @ZaheerUdDeen, you'll need to install the library in your notebook. There are instructions here under To install a Python library that show you need to run !pip install --user cloudant in a cell.
Once the package is successfully installed, you can run your python code. For example:

from cloudant.client import Cloudant
from cloudant.document import Document

client = Cloudant('username', 'password', account='username')
client.connect()
database_names = client.all_dbs()

for db_name in database_names:
    db = client[db_name]
    doc = Document(db, 'doc')
    doc.fetch()
    # do something with doc