Difficulty: Beginner
Estimated Time: 5 - 10 minutes

The Datastax Python Driver for Apache Cassandra™ is a modern, feature-rich and highly tunable Python client library for Apache Cassandra® (2.1+) and DataStax Enterprise (4.7+), and DataStax Astra, using exclusively Cassandra’s binary protocol and Cassandra Query Language (CQL) v3.

In this scenario, you will:

  • Connect to an Apache Cassandra™ instance with the DataStax Python driver
  • Use the driver to execute CQL statements against Apache Cassandra™ that do the following:
    • Create a keyspace and table programmatically
    • Insert a user into a table
    • Select that user back out
    • Update the user's email
    • Delete the user from the table
  • Process CQL query results programmatically

Congratulations! You now have the basic knowledge of using the Python driver for Apache Cassandra™.

Get your hands on the DataStax Drivers at DataStax Downloads

Help us make this better! Please give this scenario a ranking (click on the stars above).

tshirt

Try it out: DataStax Python Driver for Apache Cassandra™

Step 1 of 7

Start the Python Interactive Shell

The DataStax Python Driver for Apache Cassandra allows us to interact with Cassandra in the Python programming language. This short scenario will walk you through using CRUD operations against your instance through the Python Driver.

We will make this easy by running our commands from the Python interpreter.

Wait for Cassandra to finish starting up, this shouldn't take long! When it is finished, start the interpreter:

python:


Now that the interpreter is ready, let's create an instance of Cluster