MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / setup

Function setup

cassandra/cqlengine/connection.py:313–335  ·  view source on GitHub ↗

Set up the driver connection used by the mapper :param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`) :param str default_keyspace: The default keyspace to use :param int consistency: The global default :class:`~.ConsistencyLevel` - default is

(
        hosts,
        default_keyspace,
        consistency=None,
        lazy_connect=False,
        retry_connect=False,
        **kwargs)

Source from the content-addressed store, hash-verified

311# TODO next major: if a cloud config is specified in kwargs, hosts will be ignored.
312# This function should be refactored to reflect this change. PYTHON-1265
313def setup(
314 hosts,
315 default_keyspace,
316 consistency=None,
317 lazy_connect=False,
318 retry_connect=False,
319 **kwargs):
320 """
321 Set up the driver connection used by the mapper
322
323 :param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`)
324 :param str default_keyspace: The default keyspace to use
325 :param int consistency: The global default :class:`~.ConsistencyLevel` - default is the same as :attr:`.Session.default_consistency_level`
326 :param bool lazy_connect: True if should not connect until first use
327 :param bool retry_connect: True if we should retry to connect even if there was a connection failure initially
328 :param kwargs: Pass-through keyword arguments for :class:`cassandra.cluster.Cluster`
329 """
330
331 from cassandra.cqlengine import models
332 models.DEFAULT_KEYSPACE = default_keyspace
333
334 register_connection('default', hosts=hosts, consistency=consistency, lazy_connect=lazy_connect,
335 retry_connect=retry_connect, cluster_options=kwargs, default=True)
336
337
338def execute(query, params=None, consistency_level=None, timeout=NOT_SET, connection=None):

Callers

nothing calls this directly

Calls 1

register_connectionFunction · 0.85

Tested by

no test coverage detected