怎样使用Python在Cassandra中创建键空间?在
from cassandra.cluster import Cluster
cluster = Cluster(['cassandra.sucks.com'])
session = cluster.connect()
session.execute('CREATE KEYSPACE IF NOT EXISTS kong')
File "cassandra/cluster.py", line 1998, in cassandra.cluster.Session.execute (cassandra/cluster.c:34869)
File "cassandra/cluster.py", line 3781, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:73073)
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 0:-1 mismatched input '<EOF>' expecting K_WITH">
如果您有单个数据中心,则应使用以下查询创建键空间:
或者,如果您有多个数据中心,则使用:
^{pr2}$来源:http://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_keyspace_r.html
相关问题 更多 >
编程相关推荐