cassandra.encoder - Encoders for non-prepared Statements¶
-
class
cassandra.encoder.Encoder[source]¶ A container for mapping python types to CQL string literals when working with non-prepared statements. The type
mappingcan be directly customized by users.-
mapping= None¶ A map of python types to encoder functions.
-
cql_encode_object()[source]¶ Default encoder for all objects that do not have a specific encoder function registered. This function simply calls
str()on the object.
-
cql_encode_all_types()[source]¶ Converts any type into a CQL string, defaulting to
cql_encode_objectifmappingdoes not contain an entry for the type.
-
cql_encode_sequence()[source]¶ Converts a sequence to a string of the form
(item1, item2, ...). This is suitable forINvalue lists.
-
cql_encode_unicode()[source]¶ Converts
unicodeobjects to UTF-8 encoded strings with quote escaping.
-
cql_encode_datetime()[source]¶ Converts a
datetime.datetimeobject to a (string) integer timestamp with millisecond precision.
-
cql_encode_map_collection()[source]¶ Converts a dict into a string of the form
{key1: val1, key2: val2, ...}. This is suitable formaptype columns.
-
cql_encode_list_collection()[source]¶ Converts a sequence to a string of the form
[item1, item2, ...]. This is suitable forlisttype columns.
-
cql_encode_set_collection()[source]¶ Converts a sequence to a string of the form
{item1, item2, ...}. This is suitable forsettype columns.
-
cql_encode_tuple()¶ Converts a sequence to a string of the form
(item1, item2, ...). This is suitable fortupletype columns.
-