我想用python driver for cassandra 但是当我在python shell中运行这三行代码时
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect('demo')
我知道这个错误
cassandra.InvalidRequest: code=2200 [Invalid query] message="Keyspace 'demo' does not exist"
pip freeze说cassandra-driver==2.5.0
我查过cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.4 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> describe keyspaces
system_traces system
cqlsh>
没有名为“demo”的键空间,但我只是按照这两个教程进行操作,他们没有提到任何有关预创建键空间的内容 http://planetcassandra.org/getting-started-with-cassandra-and-python/http://datastax.github.io/python-driver/getting_started.html
创建“demo”键空间的说明位于链接自http://planetcassandra.org/getting-started-with-cassandra-and-python/的页面上:
try cassandra页面有一个开发人员演练的链接(单击“开始开发人员演练”)。开发人员演练有一个创建“demo”键空间的步骤:
创建表
相关问题 更多 >
编程相关推荐