他の例については、テストのコードを見てください
import cql
connection = cql.connect(host, port, keyspace)
cursor = connection.cursor()
query = "UPDATE StandardString1 SET :c1 = :v1, :c2 = :v2 WHERE KEY = :key"
cursor.execute(query, dict(c1="ca1", v1="va1", c2="col", v2="val", key="ka"))
cursor.execute(query, dict(c1="cb1", v1="vb1", c2="col", v2="val", key="kb"))
cursor.execute(query, dict(c1="cc1", v1="vc1", c2="col", v2="val", key="kc"))
cursor.execute(query, dict(c1="cd1", v1="vd1", c2="col", v2="val", key="kd"))
または、より具体的には、ループでの実行に関する質問に:
import cql
connection = cql.connect(host, port, keyspace)
cursor = connection.cursor()
query = "UPDATE StandardString1 SET :c1 = :v1, :c2 = :v2 WHERE KEY = :key"
values = [dict(c1="ca1", v1="va1", c2="col", v2="val", key="ka"),
dict(c1="cb1", v1="vb1", c2="col", v2="val", key="kb"),
dict(c1="cc1", v1="vc1", c2="col", v2="val", key="kc"),
dict(c1="cd1", v1="vd1", c2="col", v2="val", key="kd")]
for value in values:
cursor.execute(query, value)