The Azure Code Samples are currently available in English

Accessing Cassandra API on Azure Cosmos DB using Python

door Govind
Laatst bijgewerkt: 7-10-2018
Bewerken op GitHub

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 cosmosdb.

  • Change directories to the repo using cd cosmosdb

  • Next, substitute the contactPoint, username, password in with your Cosmos DB account's values from connectionstring panel of the portal.

    'username': '<FILLME>',
    'password': '<FILLME>',
    'contactPoint': '<FILLME>',
  • Run pip install Cassandra-driver pip install prettytable pip install requests pip install pyopenssl in a terminal to install required python packages

  • Run python in 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.

More information