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

Caution

You're viewing documentation for a previous version of Scylla Python Driver. Switch to the latest stable version.

Scylla Python Driver API Documentation cassandra.cqlengine.connection - Connection management for cqlengine

cassandra.cqlengine.connection - Connection management for cqlengine¶

cassandra.cqlengine.connection.default()¶

Configures the default connection to localhost, using the driver defaults (except for row_factory)

cassandra.cqlengine.connection.set_session(s)¶

Configures the default connection with a preexisting cassandra.cluster.Session

Note: the mapper presently requires a Session cassandra.cluster.Session.row_factory set to dict_factory. This may be relaxed in the future

cassandra.cqlengine.connection.setup(hosts, default_keyspace, consistency=None, lazy_connect=False, retry_connect=False, **kwargs)¶

Setup a the driver connection used by the mapper

Parameters
  • hosts (list) – list of hosts, (contact_points for cassandra.cluster.Cluster)

  • default_keyspace (str) – The default keyspace to use

  • consistency (int) – The global default ConsistencyLevel - default is the same as Session.default_consistency_level

  • lazy_connect (bool) – True if should not connect until first use

  • retry_connect (bool) – True if we should retry to connect even if there was a connection failure initially

  • **kwargs – Pass-through keyword arguments for cassandra.cluster.Cluster

cassandra.cqlengine.connection.register_connection(name, hosts=None, consistency=None, lazy_connect=False, retry_connect=False, cluster_options=None, default=False, session=None)¶

Add a connection to the connection registry. hosts and session are mutually exclusive, and consistency, lazy_connect, retry_connect, and cluster_options only work with hosts. Using hosts will create a new cassandra.cluster.Cluster and cassandra.cluster.Session.

Parameters
  • hosts (list) – list of hosts, (contact_points for cassandra.cluster.Cluster).

  • consistency (int) – The default ConsistencyLevel for the registered connection’s new session. Default is the same as Session.default_consistency_level. For use with hosts only; will fail when used with session.

  • lazy_connect (bool) – True if should not connect until first use. For use with hosts only; will fail when used with session.

  • retry_connect (bool) – True if we should retry to connect even if there was a connection failure initially. For use with hosts only; will fail when used with session.

  • cluster_options (dict) – A dict of options to be used as keyword arguments to cassandra.cluster.Cluster. For use with hosts only; will fail when used with session.

  • default (bool) – If True, set the new connection as the cqlengine default

  • session (Session) – A cassandra.cluster.Session to be used in the created connection.

cassandra.cqlengine.connection.unregister_connection(name)¶
cassandra.cqlengine.connection.set_default_connection(name)¶
PREVIOUS
cassandra.cqlengine.query - Query and filter model objects
NEXT
cassandra.cqlengine.management - Schema management for cqlengine
  • 3.21.0
    • 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
  • 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
  • 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