【发布时间】:2019-06-17 13:47:58
【问题描述】:
我创建表格的代码是:
c_sql = "CREATE TABLE IF NOT EXISTS {} (id varchar, version int, row_hash varchar, PRIMARY KEY((version), id)) WITH caching ('keys' : 'NONE')".format(
self.table_name
)
我的目标是减少当前为 100k 行/20 秒的读取(选择查询)时间。因此,我想拥有this answer 中建议的缓存系统。但是,我只能找到一种这样做的语法,并且会产生错误。 错误是:
Traceback (most recent call last):
File "getting_started.py", line 420, in <module>
example1.create_table_and_set_version('five_hundred_rows')
File "getting_started.py", line 116, in create_table_and_set_version
self.session.execute(c_sql)
File "cassandra/cluster.py", line 2171, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 4062, in cassandra.cluster.ResponseFuture.result
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 1:130 no viable alternative at input '(' (...version), id)) WITH [caching] (...)">
【问题讨论】:
标签: python python-3.x cassandra cql