File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22Changes 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+
5122026/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-
33382026/03/09 2.1.2
3439================
3540
Original file line number Diff line number Diff 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
85104Connection options
You can’t perform that action at this time.
0 commit comments