cassandra - Exceptions and Enums

Module Data

cassandra.

__version_info__

The version of the driver in a tuple format

cassandra.

__version__

The version of the driver in a string format

class ConsistencyLevel

Spcifies how many replicas must respond for an operation to be considered a success. By default, ONE is used for all operations.

Attributes

ANY

= 0

Only requires that one replica receives the write or the coordinator stores a hint to replay later. Valid only for writes.

ONE

= 1

Only one replica needs to respond to consider the operation a success

TWO

= 2

Two replicas must respond to consider the operation a success

THREE

= 3

Three replicas must respond to consider the operation a success

QUORUM

= 4

ceil(RF/2) replicas must respond to consider the operation a success

ALL

= 5

All replicas must respond to consider the operation a success

LOCAL_QUORUM

= 6

Requires a quorum of replicas in the local datacenter

EACH_QUORUM

= 7

Requires a quorum of replicas in each datacenter

SERIAL

= 8

For conditional inserts/updates that utilize Cassandra’s lightweight transactions, this requires consensus among all replicas for the modified data.

LOCAL_SERIAL

= 9

Like SERIAL, but only requires consensus among replicas in the local datacenter.

LOCAL_ONE

= 10

Sends a request only to replicas in the local datacenter and waits for one response.

class UserFunctionDescriptor

Describes a User function by name and argument signature

Attributes

name

= None

name of the function

argument_types

= None

Ordered list of CQL argument type names comprising the type signature

signature

function signature string in the form ‘name([type0[,type1[…]]])’

can be used to uniquely identify overloaded function names within a keyspace

class UserAggregateDescriptor

Describes a User aggregate function by name and argument signature

Attributes

name

= None

name of the aggregate

argument_types

= None

Ordered list of CQL argument type names comprising the type signature

signature

function signature string in the form ‘name([type0[,type1[…]]])’

can be used to uniquely identify overloaded function names within a keyspace

exception DriverException

Base for all exceptions explicitly raised by the driver.

exception RequestExecutionException

Base for request execution exceptions returned from the server.

exception Unavailable

There were not enough live replicas to satisfy the requested consistency level, so the coordinator node immediately failed the request without forwarding it to any replicas.

Attributes

consistency

= None

The requested ConsistencyLevel

required_replicas

= None

The number of replicas that needed to be live to complete the operation

alive_replicas

= None

The number of replicas that were actually alive

exception Timeout

Replicas failed to respond to the coordinator node before timing out.

Attributes

consistency

= None

The requested ConsistencyLevel

required_responses

= None

The number of required replica responses

received_responses

= None

The number of replicas that responded before the coordinator timed out the operation

exception ReadTimeout

A subclass of Timeout for read operations.

This indicates that the replicas failed to respond to the coordinator node before the configured timeout. This timeout is configured in cassandra.yaml with the read_request_timeout_in_ms and range_request_timeout_in_ms options.

Attributes

data_retrieved

= None

A boolean indicating whether the requested data was retrieved by the coordinator from any replicas before it timed out the operation

exception WriteTimeout

A subclass of Timeout for write operations.

This indicates that the replicas failed to respond to the coordinator node before the configured timeout. This timeout is configured in cassandra.yaml with the write_request_timeout_in_ms option.

Attributes

write_type

= None

The type of write operation, enum on WriteType

exception CoordinationFailure

Replicas sent a failure to the coordinator.

Attributes

consistency

= None

The requested ConsistencyLevel

required_responses

= None

The number of required replica responses

received_responses

= None

The number of replicas that responded before the coordinator timed out the operation

failures

= None

The number of replicas that sent a failure message

error_code_map

= None

A map of inet addresses to error codes representing replicas that sent a failure message. Only set when protocol_version is 5 or higher.

exception ReadFailure

A subclass of CoordinationFailure for read operations.

This indicates that the replicas sent a failure message to the coordinator.

Attributes

data_retrieved

= None

A boolean indicating whether the requested data was retrieved by the coordinator from any replicas before it timed out the operation

exception WriteFailure

A subclass of CoordinationFailure for write operations.

This indicates that the replicas sent a failure message to the coordinator.

Attributes

write_type

= None

The type of write operation, enum on WriteType

exception FunctionFailure

User Defined Function failed during execution

Attributes

keyspace

= None

Keyspace of the function

function

= None

Name of the function

arg_types

= None

List of argument type names of the function

exception RequestValidationException

Server request validation failed

exception ConfigurationException

Server indicated request errro due to current configuration

exception AlreadyExists

An attempt was made to create a keyspace or table that already exists.

Attributes

keyspace

= None

The name of the keyspace that already exists, or, if an attempt was made to create a new table, the keyspace that the table is in.

table

= None

The name of the table that already exists, or, if an attempt was make to create a keyspace, None.

exception InvalidRequest

A query was made that was invalid for some reason, such as trying to set the keyspace for a connection to a nonexistent keyspace.

exception Unauthorized

The current user is not authorized to perform the requested operation.

exception AuthenticationFailed

Failed to authenticate.

exception OperationTimedOut

The operation took longer than the specified (client-side) timeout to complete. This is not an error generated by Cassandra, only the driver.

Attributes

errors

= None

A dict of errors keyed by the Host against which they occurred.

last_host

= None

The last Host this operation was attempted against.