Accessing Cassandra API on Azure Cosmos DB using Python

Govind tarafından
Son güncelleştirme tarihi: 18.11.2017
GitHub üzerinde düzenleyin

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 git@github.com:Azure-Samples/Azure-Samples/azure-cosmos-db-cassandra-python-getting-started.git cosmosdb.

  • Change directories to the repo using cd cosmosdb

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

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

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