satella.cassandra package¶
Submodules¶
satella.cassandra.common module¶
satella.cassandra.future module¶
- satella.cassandra.future.wrap_future(future)¶
Convert a Cassandra’s future to a normal Python future. The returned future will be marked as running.
future is returned when it’s already a Python future.
- Parameters:
future (ResponseFuture) – cassandra future to wrap
- Returns:
a standard Python future
- Return type:
Future
satella.cassandra.parallel module¶
- satella.cassandra.parallel.parallel_for(cursor, query, arguments)¶
Syntactic sugar for
>>> futures = [] >>> for args in arguments: >>> futures.append(cursor.execute_async(query, args)) >>> for future in futures: >>> yield future.result()
If query is a string or a Cassandra Statement, or else
>>> futures = [] >>> for query, args in zip(query, arguments): >>> futures.append(cursor.execute_async(query, args)) >>> for future in futures: >>> yield future.result()
Note that if None is encountered in the argument iterable, session.execute() will be called with a single argument. You better have it as a BoundStatement then!
Deprecated since version 2.14.22: Use Cassandra feature for that
- Parameters:
cursor – the Cassandra cursor to use (obtained using connection.session())
query (Union[List[str], str, Statement, List[Statement]]) – base query or a list of queries, if a different one is to be used
arguments (Iterable[tuple]) – iterable yielding arguments to use in execute_async
- Return type:
Iterator[namedtuple]
Module contents¶
- satella.cassandra.parallel_for(cursor, query, arguments)¶
Syntactic sugar for
>>> futures = [] >>> for args in arguments: >>> futures.append(cursor.execute_async(query, args)) >>> for future in futures: >>> yield future.result()
If query is a string or a Cassandra Statement, or else
>>> futures = [] >>> for query, args in zip(query, arguments): >>> futures.append(cursor.execute_async(query, args)) >>> for future in futures: >>> yield future.result()
Note that if None is encountered in the argument iterable, session.execute() will be called with a single argument. You better have it as a BoundStatement then!
Deprecated since version 2.14.22: Use Cassandra feature for that
- Parameters:
cursor – the Cassandra cursor to use (obtained using connection.session())
query (Union[List[str], str, Statement, List[Statement]]) – base query or a list of queries, if a different one is to be used
arguments (Iterable[tuple]) – iterable yielding arguments to use in execute_async
- Return type:
Iterator[namedtuple]
- satella.cassandra.wrap_future(future)¶
Convert a Cassandra’s future to a normal Python future. The returned future will be marked as running.
future is returned when it’s already a Python future.
- Parameters:
future (ResponseFuture) – cassandra future to wrap
- Returns:
a standard Python future
- Return type:
Future