0
我有一個表中卡桑德拉像:插入卡桑德拉蟒列表
CREATE TABLE IF NOT EXISTS article(
url text PRIMARY KEY,
title text,
author text,
sources list<text>)
我有一個對象Article
用下面的方法來將數據插入到卡桑德拉:
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"])
)
問題是我應該使用什麼來代替????
來正確格式化字符串