Scylla Documentation Logo Documentation
  • Server
    • Scylla Open Source
    • Scylla Enterprise
    • Scylla Alternator
  • Cloud
    • Scylla Cloud
    • Scylla Cloud Docs
  • Tools
    • Scylla Manager
    • Scylla Monitoring Stack
    • Scylla Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
Download
Menu
Scylla Python Driver API Documentation cassandra.encoder - Encoders for non-prepared Statements

cassandra.encoder - Encoders for non-prepared Statements¶

class cassandra.encoder.Encoder¶

A container for mapping python types to CQL string literals when working with non-prepared statements. The type mapping can be directly customized by users.

mapping = None¶

A map of python types to encoder functions.

cql_encode_none()¶

Converts None to the string ‘NULL’.

cql_encode_object()¶

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()¶

Converts any type into a CQL string, defaulting to cql_encode_object if mapping does not contain an entry for the type.

cql_encode_sequence()¶

Converts a sequence to a string of the form (item1, item2, ...). This is suitable for IN value lists.

cql_encode_str()¶

Escapes quotes in str objects.

cql_encode_unicode()¶

Converts unicode objects to UTF-8 encoded strings with quote escaping.

cql_encode_bytes()¶

Converts strings, buffers, and bytearrays into CQL blob literals.

cql_encode_datetime()¶

Converts a datetime.datetime object to a (string) integer timestamp with millisecond precision.

cql_encode_date()¶

Converts a datetime.date object to a string with format YYYY-MM-DD.

cql_encode_map_collection()¶

Converts a dict into a string of the form {key1: val1, key2: val2, ...}. This is suitable for map type columns.

cql_encode_list_collection()¶

Converts a sequence to a string of the form [item1, item2, ...]. This is suitable for list type columns.

cql_encode_set_collection()¶

Converts a sequence to a string of the form {item1, item2, ...}. This is suitable for set type columns.

cql_encode_tuple()¶

Converts a sequence to a string of the form (item1, item2, ...). This is suitable for tuple type columns.

PREVIOUS
cassandra.protocol - Protocol Features
NEXT
cassandra.decoder - Data Return Formats
  • 3.25.4
    • 3.25.4
    • 3.24.8
    • 3.22.3
    • 3.21.0
  • API Documentation
    • cassandra - Exceptions and Enums
    • cassandra.cluster - Clusters and Sessions
    • cassandra.policies - Load balancing and Failure Handling Policies
    • cassandra.auth - Authentication
    • cassandra.graph - Graph Statements, Options, and Row Factories
    • cassandra.metadata - Schema and Ring Topology
    • cassandra.metrics - Performance Metrics
    • cassandra.query - Prepared Statements, Batch Statements, Tracing, and Row Factories
    • cassandra.pool - Hosts and Connection Pools
    • cassandra.protocol - Protocol Features
    • cassandra.encoder - Encoders for non-prepared Statements
    • cassandra.decoder - Data Return Formats
    • cassandra.concurrent - Utilities for Concurrent Statement Execution
    • cassandra.connection - Low Level Connection Info
    • cassandra.util - Utilities
    • cassandra.timestamps - Timestamp Generation
    • cassandra.io.asyncioreactor - asyncio Event Loop
    • cassandra.io.asyncorereactor - asyncore Event Loop
    • cassandra.io.eventletreactor - eventlet-compatible Connection
    • cassandra.io.libevreactor - libev Event Loop
    • cassandra.io.geventreactor - gevent-compatible Event Loop
    • cassandra.io.twistedreactor - Twisted Event Loop
    • cassandra.cqlengine.models - Table models for object mapping
    • cassandra.cqlengine.columns - Column types for object mapping models
    • cassandra.cqlengine.query - Query and filter model objects
    • cassandra.cqlengine.connection - Connection management for cqlengine
    • cassandra.cqlengine.management - Schema management for cqlengine
    • cassandra.cqlengine.usertype - Model classes for User Defined Types
    • cassandra.datastax.graph - Graph Statements, Options, and Row Factories
    • cassandra.datastax.graph.fluent
    • cassandra.datastax.graph.fluent.query
    • cassandra.datastax.graph.fluent.predicates
  • Installation
  • Getting Started
  • Scylla Specific Features
  • Upgrading
  • Execution Profiles
  • Performance Notes
  • Paging Large Queries
  • Lightweight Transactions (Compare-and-set)
  • Security
  • User Defined Types
  • Object Mapper
    • Upgrade Guide
    • Models
    • Making Queries
    • Batch Queries
    • Connections
    • Third party integrations
    • Frequently Asked Questions
  • Working with Dates and Times
  • Scylla Cloud
  • Frequently Asked Questions
  • Create an issue
  • Edit this page
Logo
Docs Contact Us About Us
Mail List Icon Slack Icon
© ScyllaDB 2021 and © DataStax 2013-2017
Powered by Sphinx 4.3.2 & ScyllaDB Theme 1.2.2