[英]cql query statement is not working when i using timestamp string
It's likely that there are special characters in the variables causing an issue.变量中可能有特殊字符导致问题。 A prepared statement is a good way to insulate against that.
准备好的声明是一种避免这种情况的好方法。 So instead of this:
所以代替这个:
session.execute("INSERT INTO test_table(id,time) VALUES ({},{});".format(uuid.uuid1(),timestamp))
Try using a prepared statement, like this:尝试使用准备好的语句,如下所示:
strCQL = "INSERT INTO test_table(id,time) VALUES (?,?);"
pStatement = session.prepare(strCQL)
session.execute(pStatement,[uuid.uuid1(),timestamp])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.