簡體   English   中英

Spark + cassandra:如何創建密鑰空間?

[英]Spark + cassandra : how to create a keyspace?

我正在經歷pyspark_cassandra

但是我沒有看到任何創建表/鍵空間的方法=>有可能嗎?

如果是這樣,怎么樣?

也許你可以試試這個包嗎?

這個包來自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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM