Cassandra - mwicat/personal GitHub Wiki

Connect to cassandra

sudo pip install python-driver
keyspace = 'mykeyspace'
from cassandra.cluster import Cluster
cluster = Cluster(['localhost'], port=9042)
session = cluster.connect(keyspace)
r = session.execute('select count(*) from entity2')
print r[0].count