Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Commit 3fa8cd9

Browse files
committed
Merge branch 'pr510'
Conflicts: cassandra/cluster.py
2 parents f6d5558 + 51632f8 commit 3fa8cd9

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

cassandra/cluster.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,15 @@ class Session(object):
14441444
default changed from ONE to LOCAL_ONE
14451445
"""
14461446

1447+
default_serial_consistency_level = None
1448+
"""
1449+
The default :class:`~ConsistencyLevel` for serial phase of conditional updates executed through
1450+
this session. This default may be overridden by setting the
1451+
:attr:`~.Statement.serial_consistency_level` on individual statements.
1452+
1453+
Only valid for ``protocol_version >= 2``.
1454+
"""
1455+
14471456
max_trace_wait = 2.0
14481457
"""
14491458
The maximum amount of time (in seconds) the driver will wait for trace
@@ -1635,6 +1644,8 @@ def _create_response_future(self, query, parameters, trace, custom_payload, time
16351644
query = query.bind(parameters)
16361645

16371646
cl = query.consistency_level if query.consistency_level is not None else self.default_consistency_level
1647+
serial_cl = query.serial_consistency_level if query.serial_consistency_level is not None else self.default_serial_consistency_level
1648+
16381649
fetch_size = query.fetch_size
16391650
if fetch_size is FETCH_SIZE_UNSET and self._protocol_version >= 2:
16401651
fetch_size = self.default_fetch_size
@@ -1651,12 +1662,12 @@ def _create_response_future(self, query, parameters, trace, custom_payload, time
16511662
if parameters:
16521663
query_string = bind_params(query_string, parameters, self.encoder)
16531664
message = QueryMessage(
1654-
query_string, cl, query.serial_consistency_level,
1665+
query_string, cl, serial_cl,
16551666
fetch_size, timestamp=timestamp)
16561667
elif isinstance(query, BoundStatement):
16571668
message = ExecuteMessage(
16581669
query.prepared_statement.query_id, query.values, cl,
1659-
query.serial_consistency_level, fetch_size,
1670+
serial_cl, fetch_size,
16601671
timestamp=timestamp)
16611672
prepared_statement = query.prepared_statement
16621673
elif isinstance(query, BatchStatement):
@@ -1667,7 +1678,7 @@ def _create_response_future(self, query, parameters, trace, custom_payload, time
16671678
"setting Cluster.protocol_version to 2 to support this operation.")
16681679
message = BatchMessage(
16691680
query.batch_type, query._statements_and_parameters, cl,
1670-
query.serial_consistency_level, timestamp)
1681+
serial_cl, timestamp)
16711682

16721683
message.tracing = trace
16731684

docs/api/cassandra/cluster.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
.. autoattribute:: default_consistency_level
100100
:annotation: = LOCAL_ONE
101101

102+
.. autoattribute:: default_serial_consistency_level
103+
102104
.. autoattribute:: row_factory
103105

104106
.. autoattribute:: default_fetch_size

0 commit comments

Comments
 (0)