【发布时间】:2021-03-11 03:41:00
【问题描述】:
我正在尝试使用 python 客户端更新 cassandra 数据库,如下所示。
def update_content(session, id, content)
update_statement = """
UPDATE mytable SET content='{}' WHERE id={}
"""
session.execute(update_statement.format(content, id))
它适用于大多数情况,但在某些情况下,内容是表单的字符串
content = "Content Message -'[re]...)"
导致错误异常调用应用程序: p>
我不知道为什么会这样? cassandra 是否试图以某种方式将字符串解释为正则表达式。
我尝试在更新前打印数据,看起来不错
"UPDATE mytable SET content='Content Message -'[re]...)' WHERE id=2"
【问题讨论】:
标签: python python-3.x cassandra cqlsh