[英]Spark + cassandra : how to create a keyspace?
也許你可以試試這個包嗎?
這個包來自DataStax,它是python的Cassandra驅動程序。
Github: https : //github.com/datastax/python-driver
API文檔: https : //datastax.github.io/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 };')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.