【发布时间】:2017-06-28 08:48:35
【问题描述】:
我在 Cassandra 有一张桌子,例如:
CREATE TABLE IF NOT EXISTS article(
url text PRIMARY KEY,
title text,
author text,
sources list<text>)
我有一个对象Article,它使用以下方法将数据插入到cassandra:
def save_to_cassandra(self, session):
session.execute(
"""
INSERT INTO article (url, title, author, sources)
VALUES (%s, %s, %s, ????)
""",
(self.url, self.title, self.author, ["http://source1.com", "http://source2.com"])
)
问题是我应该使用什么来代替???? 来正确格式化字符串
【问题讨论】:
标签: python database string cassandra formatting