File tree 4 files changed +13
-15
lines changed
4 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -508,7 +508,7 @@ def connect(
508
508
pool = None ,
509
509
user_agent = None ,
510
510
client = None ,
511
- route_to_leader_enabled = False ,
511
+ route_to_leader_enabled = True ,
512
512
):
513
513
"""Creates a connection to a Google Cloud Spanner database.
514
514
@@ -547,10 +547,9 @@ def connect(
547
547
548
548
:type route_to_leader_enabled: boolean
549
549
:param route_to_leader_enabled:
550
- (Optional) Default False. Set route_to_leader_enabled as True to
551
- enable leader aware routing. Enabling leader aware routing
552
- would route all requests in RW/PDML transactions to the
553
- leader region.
550
+ (Optional) Default True. Set route_to_leader_enabled as False to
551
+ disable leader aware routing. Disabling leader aware routing would
552
+ route all requests in RW/PDML transactions to the closest region.
554
553
555
554
556
555
:rtype: :class:`google.cloud.spanner_dbapi.connection.Connection`
@@ -568,14 +567,14 @@ def connect(
568
567
credentials ,
569
568
project = project ,
570
569
client_info = client_info ,
571
- route_to_leader_enabled = False ,
570
+ route_to_leader_enabled = True ,
572
571
)
573
572
else :
574
573
client = spanner .Client (
575
574
project = project ,
576
575
credentials = credentials ,
577
576
client_info = client_info ,
578
- route_to_leader_enabled = False ,
577
+ route_to_leader_enabled = True ,
579
578
)
580
579
else :
581
580
if project is not None and client .project != project :
Original file line number Diff line number Diff line change @@ -116,10 +116,9 @@ class Client(ClientWithProject):
116
116
117
117
:type route_to_leader_enabled: boolean
118
118
:param route_to_leader_enabled:
119
- (Optional) Default False. Set route_to_leader_enabled as True to
120
- enable leader aware routing. Enabling leader aware routing
121
- would route all requests in RW/PDML transactions to the
122
- leader region.
119
+ (Optional) Default True. Set route_to_leader_enabled as False to
120
+ disable leader aware routing. Disabling leader aware routing would
121
+ route all requests in RW/PDML transactions to the closest region.
123
122
124
123
:raises: :class:`ValueError <exceptions.ValueError>` if both ``read_only``
125
124
and ``admin`` are :data:`True`
@@ -139,7 +138,7 @@ def __init__(
139
138
client_info = _CLIENT_INFO ,
140
139
client_options = None ,
141
140
query_options = None ,
142
- route_to_leader_enabled = False ,
141
+ route_to_leader_enabled = True ,
143
142
):
144
143
self ._emulator_host = _get_spanner_emulator_host ()
145
144
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ def test_w_explicit(self, mock_client):
86
86
project = PROJECT ,
87
87
credentials = credentials ,
88
88
client_info = mock .ANY ,
89
- route_to_leader_enabled = False ,
89
+ route_to_leader_enabled = True ,
90
90
)
91
91
client_info = mock_client .call_args_list [0 ][1 ]["client_info" ]
92
92
self .assertEqual (client_info .user_agent , USER_AGENT )
@@ -120,7 +120,7 @@ def test_w_credential_file_path(self, mock_client):
120
120
credentials_path ,
121
121
project = PROJECT ,
122
122
client_info = mock .ANY ,
123
- route_to_leader_enabled = False ,
123
+ route_to_leader_enabled = True ,
124
124
)
125
125
client_info = factory .call_args_list [0 ][1 ]["client_info" ]
126
126
self .assertEqual (client_info .user_agent , USER_AGENT )
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def _constructor_test_helper(
59
59
client_options = None ,
60
60
query_options = None ,
61
61
expected_query_options = None ,
62
- route_to_leader_enabled = None ,
62
+ route_to_leader_enabled = True ,
63
63
):
64
64
import google .api_core .client_options
65
65
from google .cloud .spanner_v1 import client as MUT
You can’t perform that action at this time.
0 commit comments