First, before we start playing around, we need to install the Python driver pip install cassandra-driver; the following snippet of code just lists the content of a table in the Cassandra cluster:
from cassandra.cluster import Cluster import cassandra.util import uuid import numpy as np # Considering that the cluster is on localhost cluster = Cluster() # Other option if you know the IPs # cluster = Cluster(['192.168.0.1', '192.168.0.2']) # Get a session to the database session = cluster.connect('mydb') # Doing a query rows = session.execute('SELECT * FROM tb_drive limit 5') print('Columns:',rows.column_names) for row in rows: print(row.id, row.acc, row.wheel_angle)