Hello Siham, you need to use the service credentials that you can generate by entering Cloudant.
You will need to reference the username and apikey afterwards. Pls see the code below, it is an example of how to connect to Cloudant and create a pandas data frame.
Hope this helps.
Massimo
.... And here a function to create new records in cloudant
# =============================================================================
# DB data writing (recording the new record in Cloudant)
# =============================================================================
def db_data_writing(credential:dict, db_name:str, files:dict):
"""
DB data writing
This function reach the online database and write the input files as a new document
Parameters
----------
credential: dict
credential to access the online Cloudant database instance
db_name: str
name of the database on which write data
files: dict
json containing data to write on db
Returns
-------
bool
exit status
"""
# Feed credential and establish a connection
client = Cloudant.iam(credential["username"],credential["apikey"],connect=True)
# Select the database instance on which write results
db = client[db_name]
# write and save document
db.create_document(files).save()
# shutdown the connection
client.disconnect()
------------------------------
Massimo Loaldi
------------------------------
Original Message:
Sent: Mon May 17, 2021 05:05 PM
From: Siham Si hadj mohand
Subject: Using Cloudant database from Jupyter Notebooks
Hello,
I want to record our data processing results in our cloudant database from watson studio using spark & python environment.
I found the way to make a connection with the cloudant database from jupyter notebook in this link "https://medium.com/@glynn_bird/using-cloudant-from-jupyter-notebooks-acf36428d65c"
But I didn't find the password in my Cloudant account's admin credentials.
How could I connect to the cloudant from watson studio without using the passward?
Thanks
------------------------------
Siham Si hadj mohand
------------------------------
#WatsonStudio