Connection¶
Users of versions < 0.4, please read this post before upgrading: Breaking Changes
The setup function in cqlengine.connection records the Cassandra servers to connect to. If there is a problem with one of the servers, cqlengine will try to connect to each of the other connections before failing.
-
cqlengine.connection.
setup
(hosts)¶ Parameters: - hosts (list) – list of hosts, strings in the <hostname>:<port>, or just <hostname>
- default_keyspace (str) – keyspace to default to
- consistency (int) – the consistency level of the connection, defaults to ‘ONE’
# see http://datastax.github.io/python-driver/api/cassandra.html#cassandra.ConsistencyLevel
Records the hosts and connects to one of them
See the example at Getting Started