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

Commit 5d97c1e

Browse files
committed
is_schema_agreed attribute for insight following DDL requests
PYTHON-458
1 parent 5542112 commit 5d97c1e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

cassandra/cluster.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2614,7 +2614,7 @@ def refresh_schema_and_set_result(control_conn, response_future, **kwargs):
26142614
if control_conn._meta_refresh_enabled:
26152615
log.debug("Refreshing schema in response to schema change. "
26162616
"%s", kwargs)
2617-
control_conn._refresh_schema(response_future._connection, **kwargs)
2617+
response_future.is_schema_agreed = control_conn._refresh_schema(response_future._connection, **kwargs)
26182618
else:
26192619
log.debug("Skipping schema refresh in response to schema change because meta refresh is disabled; "
26202620
"%s", kwargs)
@@ -2643,6 +2643,13 @@ class ResponseFuture(object):
26432643
:class:`.ResponseFuture`.
26442644
"""
26452645

2646+
is_schema_agreed = True
2647+
"""
2648+
For DDL requests, this may be set ``False`` if the schema agreement poll after the response fails.
2649+
2650+
Always ``True`` for non-DDL requests.
2651+
"""
2652+
26462653
session = None
26472654
row_factory = None
26482655
message = None
@@ -2866,6 +2873,7 @@ def _set_result(self, response):
28662873
elif response.kind == RESULT_KIND_SCHEMA_CHANGE:
28672874
# refresh the schema before responding, but do it in another
28682875
# thread instead of the event loop thread
2876+
self.is_schema_agreed = False
28692877
self.session.submit(
28702878
refresh_schema_and_set_result,
28712879
self.session.cluster.control_connection,

docs/api/cassandra/cluster.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131

132132
.. autoattribute:: custom_payload()
133133

134+
.. autoattribute:: is_schema_agreed
135+
134136
.. autoattribute:: has_more_pages
135137

136138
.. autoattribute:: warnings

0 commit comments

Comments
 (0)