Azure-Samples / azure-cosmos-db-cassandra-python-getting-started

This repository contains python code showcasing interaction with Cassandra API of Azure Cosmos DB which showcases creation, query and cleanup of data
6 stars 13 forks source link

page_type: sample languages:

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

  1. Clone this repository using git clone git@github.com:Azure-Samples/Azure-Samples/azure-cosmos-db-cassandra-python-getting-started.git cosmosdb.

  2. Change directories to the repo using cd cosmosdb

  3. 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'
  4. Run

    pip install Cassandra-driver 
    pip install prettytable
    pip install requests
    pip install pyopenssl

    in a terminal to install required python packages

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