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

For more learning on CQL, try the Cassandra Fundamentals learning series on datastax.com/dev.

Was this helpful? Please give this scenario a rating (click on the stars above).

Have questions or more feedback? Send us a message.

Want a free 5 GB Cassandra database in the cloud to continue experimenting? Sign up and launch your database with a few clicks at astra.datastax.com!

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