Skip to content

Instantly share code, notes, and snippets.

@tgrabiec
Last active November 18, 2020 22:14
Show Gist options
  • Save tgrabiec/fb8ee3e3730a04666eedf6c46bc90b94 to your computer and use it in GitHub Desktop.
Save tgrabiec/fb8ee3e3730a04666eedf6c46bc90b94 to your computer and use it in GitHub Desktop.
from cassandra.cluster import Cluster
import random
cluster = Cluster()
session = cluster.connect()
session.execute('drop keyspace ks')
session.execute("create keyspace ks WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1 };")
session.set_keyspace('ks')
prev = None
for i in range(468):
id = random.uniform(1, 100000)
print(i, id)
if prev:
session.execute('drop table ks.t%d' % prev)
session.execute('create table ks.t%d (p int primary key, r1 int, r2 int, r3 int, r4 int);' % id)
prev = id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment