Skip to content

Commit ca04410

Browse files
committed
Use prepared statements for benchmarks
1 parent 9418167 commit ca04410

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

benchmarks/base.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from cassandra.cluster import Cluster
1616
from cassandra.io.asyncorereactor import AsyncoreConnection
1717
from cassandra.policies import HostDistance
18-
from cassandra.query import SimpleStatement
1918

2019
log = logging.getLogger()
2120
handler = logging.StreamHandler()
@@ -86,11 +85,10 @@ def benchmark(thread_class):
8685
log.debug("Sleeping for two seconds...")
8786
time.sleep(2.0)
8887

89-
query = SimpleStatement("""
90-
INSERT INTO {table} (thekey, col1, col2)
91-
VALUES (%(key)s, %(a)s, %(b)s)
88+
query = session.prepare("""
89+
INSERT INTO {table} (thekey, col1, col2) VALUES (?, ?, ?))
9290
""".format(table=TABLE))
93-
values = {'key': 'key', 'a': 'a', 'b': 'b'}
91+
values = ('key', 'a', 'b')
9492

9593
per_thread = options.num_ops / options.threads
9694
threads = []

0 commit comments

Comments
 (0)