Spark + cassandra: how to create a keyspace?

I am surviving pyspark_cassandra .

But I see no way to create a table / keyspace => is it even possible?

If so, how?

+6
source share
1 answer

Perhaps you can try this package?

This package is from DataStax, which is the Cassandra driver for python.

Github: https://github.com/datastax/python-driver

API docs: https://datastax.imtqy.com/python-driver/api/cassandra/cluster.html

from cassandra.cluster import Cluster cluster = Cluster(['your_cassandra_ip']) session = cluster.connect() session.execute('CREATE KEYSPACE IF NOT EXISTS mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };') 
0
source

Source: https://habr.com/ru/post/1013132/


All Articles