Accessing Cassandra API on Azure Cosmos DB using Python
Azure Cosmos DB is Microsoft's globally distributed multi-model database service. You can quickly create and query document, table, key-value, and graph databases, all of which benefit from the global distribution and horizontal scale capabilities at the core of Azure Cosmos DB. This quick start demonstrates how to create an Azure Cosmos DB account for the Cassandra API by using the Azure portal. You'll then build a user profile console app, output as shown in the following image, with sample data.
Running this sample
Before you can run this sample, you must have the following perquisites:
Clone this repository using
git clone firstname.lastname@example.org:Azure-Samples/Azure-Samples/azure-cosmos-db-cassandra-python-getting-started.git cosmosdb.
Change directories to the repo using
Next, substitute the contactPoint, username, password in
config.pywith your Cosmos DB account's values from connectionstring panel of the portal.
'username': '<FILLME>', 'password': '<FILLME>', 'contactPoint': '<FILLME>', 'port':'10350'
pip install Cassandra-driver pip install prettytable pip install requests pip install pyopensslin a terminal to install required python packages
python pyquickstart.pyin a terminal to execute it.
About the code
The code included in this sample is intended to get you quickly started with a python program that connects to Azure Cosmos DB with the Cassandra API.