Skip to content

Commit 2496b4c

Browse files
committed
Update docs with new changes
1 parent 31fcc5d commit 2496b4c

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

CHANGES.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changes for crate
33
=================
44

5+
Unreleased
6+
================
7+
8+
- Breaking change: ``connect()`` now raises ``ConnectionError`` immediately if
9+
no configured server node responds. Changed connection behaviour to fail early
10+
if the database cluster does not respond.
11+
512
2026/06/17 2.2.1
613
================
714

@@ -28,8 +35,6 @@ Changes for crate
2835
``%(name)s`` placeholders and converts them to positional ``?`` markers
2936
client-side. Positional parameters using ``?`` continue to work unchanged.
3037

31-
- Changed connection behaviour to fail early if the database cluster does not respond
32-
3338
2026/03/09 2.1.2
3439
================
3540

docs/connect.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,32 @@ You can pass in as many node URLs as you like.
7373

7474
.. TIP::
7575

76-
For every query, the client will attempt to connect to each node in sequence
76+
When ``connect()`` is called, the client contacts each node to check
77+
availability and determine the lowest server version. If no node responds,
78+
a ``ConnectionError`` is raised immediately.
79+
80+
For every subsequent query, the client will attempt each node in sequence
7781
until a successful connection is made. Nodes are moved to the end of the
7882
list each time they are tried.
7983

8084
Over multiple query executions, this behaviour functions as client-side
8185
*round-robin* load balancing. (This is analogous to `round-robin DNS`_.)
8286

87+
.. NOTE::
88+
89+
Wrap ``connect()`` in a ``try/except`` block to handle an unreachable
90+
cluster gracefully:
91+
92+
.. code-block:: python
93+
94+
from crate import client
95+
from crate.client.exceptions import ConnectionError
96+
97+
try:
98+
connection = client.connect(["node-1:4200", "node-2:4200"])
99+
except ConnectionError as e:
100+
print(f"Could not reach CrateDB cluster: {e}")
101+
83102
.. _connection-options:
84103

85104
Connection options

0 commit comments

Comments
 (0)