forked from apache/cassandra-dtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cql_prepared_test.py
39 lines (28 loc) · 885 Bytes
/
cql_prepared_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import time
import pytest
import logging
from dtest import Tester, create_ks
since = pytest.mark.since
logger = logging.getLogger(__name__)
@since("1.2")
class TestCQL(Tester):
def prepare(self):
cluster = self.cluster
cluster.populate(1).start()
node1 = cluster.nodelist()[0]
time.sleep(0.2)
session = self.patient_cql_connection(node1)
create_ks(session, 'ks', 1)
return session
def test_batch_preparation(self):
""" Test preparation of batch statement (#4202) """
session = self.prepare()
session.execute("""
CREATE TABLE cf (
k varchar PRIMARY KEY,
c int,
)
""")
query = "BEGIN BATCH INSERT INTO cf (k, c) VALUES (?, ?); APPLY BATCH"
pq = session.prepare(query)
session.execute(pq, ['foo', 4])