some docs improvement for 3.7.0
This commit is contained in:
parent
4f6d88ad1c
commit
39f8202990
@ -939,6 +939,9 @@ class NoSpeculativeExecutionPolicy(SpeculativeExecutionPolicy):
|
|||||||
|
|
||||||
|
|
||||||
class ConstantSpeculativeExecutionPolicy(SpeculativeExecutionPolicy):
|
class ConstantSpeculativeExecutionPolicy(SpeculativeExecutionPolicy):
|
||||||
|
"""
|
||||||
|
A speculative execution policy that sends a new query every X seconds (**delay**) for a maximum of Y attempts (**max_attempts**).
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, delay, max_attempts):
|
def __init__(self, delay, max_attempts):
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
|
@ -68,3 +68,12 @@ Retrying Failed Operations
|
|||||||
|
|
||||||
.. autoclass:: DowngradingConsistencyRetryPolicy
|
.. autoclass:: DowngradingConsistencyRetryPolicy
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
Retrying Idempotent Operations
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
.. autoclass:: SpeculativeExecutionPolicy
|
||||||
|
:members:
|
||||||
|
|
||||||
|
.. autoclass:: ConstantSpeculativeExecutionPolicy
|
||||||
|
:members:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Paging Large Queries
|
Paging Large Queries
|
||||||
====================
|
====================
|
||||||
Cassandra 2.0+ offers support for automatic query paging. Starting with
|
Cassandra 2.0+ offers support for automatic query paging. Starting with
|
||||||
version 2.0 of the driver, if :attr:`~.Cluster.protocol_version` is greater than
|
version 2.0 of the driver, if :attr:`~.Cluster.protocol_version` is greater than
|
||||||
:const:`2` (it is by default), queries returning large result sets will be
|
:const:`2` (it is by default), queries returning large result sets will be
|
||||||
automatically paged.
|
automatically paged.
|
||||||
|
|
||||||
@ -74,3 +74,22 @@ pages. For example::
|
|||||||
handler.finished_event.wait()
|
handler.finished_event.wait()
|
||||||
if handler.error:
|
if handler.error:
|
||||||
raise handler.error
|
raise handler.error
|
||||||
|
|
||||||
|
Resume Paged Results
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
You can resume the pagination when executing a new query by using the :attr:`.ResultSet.paging_state`. This can be useful if you want to provide some stateless pagination capabilities to your application (ie. via http). For example::
|
||||||
|
|
||||||
|
from cassandra.query import SimpleStatement
|
||||||
|
query = "SELECT * FROM users"
|
||||||
|
statement = SimpleStatement(query, fetch_size=10)
|
||||||
|
results = session.execute(statement)
|
||||||
|
|
||||||
|
# save the paging_state somewhere and return current results
|
||||||
|
session['paging_stage'] = results.paging_state
|
||||||
|
|
||||||
|
|
||||||
|
# resume the pagination sometime later...
|
||||||
|
statement = SimpleStatement(query, fetch_size=10)
|
||||||
|
ps = session['paging_state']
|
||||||
|
results = session.execute(statement, paging_state=ps)
|
||||||
|
Loading…
Reference in New Issue
Block a user