Python CQL不是字符串格式化期间转换的所有参数

Python CQL不是字符串格式化期间转换的所有参数,python,python-3.x,cassandra,cql,Python,Python 3.x,Cassandra,Cql,我试图在Python中使用CQL执行insert语句 表定义为: CREATE TABLE test_keyspace.test_table ( key1 text PRIMARY KEY, key2 text, key3 int, key4 float, key5 float ) WITH bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND comment =

我试图在
Python
中使用
CQL
执行insert语句

表定义为:

CREATE TABLE test_keyspace.test_table (
key1 text PRIMARY KEY,
key2 text,
key3 int,
key4 float,
key5 float
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
Python代码是:

no_of_rows = 10000

insert_test_pre_stm = "INSERT INTO test_table (key1, key2, key3, key4, key5) VALUES (?, ?, ?, ?, ?)"


for row in range(no_of_rows):
    key = 'test' + str(row)
    session.execute(insert_test_pre_stm, [key, 'test', 1900, 1.0, 1.0])
错误是:

TypeError: not all arguments converted during string formatting
更新


我已经解决了这个问题,这是因为没有使用准备好的语句(
session.prepare

我想你应该加上这个答案。我差点错过了。不过谢谢你,我是疯了我认为你应该加上这个答案。我差点错过了。不过谢谢你,我是疯了D