Skip to content

Azure-Samples/azure-cassandra-mi-python-v4-getting-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

page_type languages products description urlFragment
sample
python
azure
Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra datacenters.
azure-cassandra-mi-python-getting-started

Accessing Azure Managed Instance for Apache Cassandra using Python

Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra datacenters. It accelerates hybrid scenarios and reduces ongoing maintenance.

This quick start demonstrates how to connect to a Cassandra Managed instance cluster with Python. 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:
    • An Azure Managed Instance for Apache Cassandra cluster. Check out our Quickstart guide here.
    • Networking access from this application to your Azure Managed Instance for Apache Cassandra cluster (the service only deploys private IP addresses injected into a Virtual network).
    • A version of Python that supports the Cassandra driver version. For example, cassandra-driver==3.20.2 supports only Python versions 2.7, 3.4, 3.5, 3.6 and 3.7.
    • Git.
    • Python Driver - Note: Cassandra driver version 3.20.2 is the latest Python driver that supports the v4 wire protocol for open source Apache Cassandra by default. If using a later version, please explicitly set protocol_version to 4 (see sample).
  1. Clone this repository using git clone https://github.com/Azure-Samples/Azure-Samples/azure-cassandra-mi-python-v4-getting-started.git.

  2. Replace <FILLME> in username, password, contactPoint and datacenter-name with the appropriate values in config.py. The contactPoint should be one of the private I.P. seed nodes in your cluster.

    'username': '<FILLME>',
    'password': '<FILLME>',
    'contactPoint': '<FILLME>',
    'datacenter-name': '<FILLME>',
    'port':9042
  3. Run the below in a terminal to install required python packages.

    pip install cassandra-driver
    pip install prettytable
    pip install requests
    pip install pyopenssl
  4. Run python pyquickstart.py in a terminal to execute it.

    Console output

About the code

The code included in this sample is intended to get you quickly started with a python program that connects to Azure Managed Instance for Apache Cassandra.

About

This repository contains python sample code for connecting to Azure Managed Instance for Apache Cassandra and creating and querying data

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages