如果下面的 Python 代码不存在该表,我将创建一个 cassandra 表:
cluster = cassandra_cluster.Cluster([settings.CASSANDRA_CONTACT_POINT],
settings.CASSANDRA_PORT)
session = cluster.connect(settings.CASSANDRA_KEYSPACE)
session.execute("CREATE TABLE IF NOT EXISTS %s(id uuid PRIMARY
KEY,input text,predicted_result text,timestamp timestamp" % modelId)
当我设置 modelID = 12345 时,终端出现错误。
SyntaxException: <Error from server: code=2000 [Syntax error in CQL
query] message="line 1:27 no viable alternative at input '12345' (
CREATE TABLE IF NOT EXISTS [12345]...)">
我的语法有什么问题?