Skip to content

Commit 75e8a59

Browse files
surbhigarg92rajatbhattaparthea
authored
feat: Set LAR as False (googleapis#980)
* feat: Set LAR as False * Update google/cloud/spanner_dbapi/connection.py Co-authored-by: Rajat Bhatta <[email protected]> * Update google/cloud/spanner_v1/client.py Co-authored-by: Rajat Bhatta <[email protected]> --------- Co-authored-by: Rajat Bhatta <[email protected]> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 447fc3c commit 75e8a59

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

google/cloud/spanner_dbapi/connection.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def connect(
508508
pool=None,
509509
user_agent=None,
510510
client=None,
511-
route_to_leader_enabled=True,
511+
route_to_leader_enabled=False,
512512
):
513513
"""Creates a connection to a Google Cloud Spanner database.
514514
@@ -547,9 +547,10 @@ def connect(
547547
548548
:type route_to_leader_enabled: boolean
549549
:param route_to_leader_enabled:
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.
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.
553554
554555
555556
:rtype: :class:`google.cloud.spanner_dbapi.connection.Connection`
@@ -567,14 +568,14 @@ def connect(
567568
credentials,
568569
project=project,
569570
client_info=client_info,
570-
route_to_leader_enabled=True,
571+
route_to_leader_enabled=False,
571572
)
572573
else:
573574
client = spanner.Client(
574575
project=project,
575576
credentials=credentials,
576577
client_info=client_info,
577-
route_to_leader_enabled=True,
578+
route_to_leader_enabled=False,
578579
)
579580
else:
580581
if project is not None and client.project != project:

google/cloud/spanner_v1/client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ class Client(ClientWithProject):
116116
117117
:type route_to_leader_enabled: boolean
118118
:param route_to_leader_enabled:
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.
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.
122123
123124
:raises: :class:`ValueError <exceptions.ValueError>` if both ``read_only``
124125
and ``admin`` are :data:`True`
@@ -138,7 +139,7 @@ def __init__(
138139
client_info=_CLIENT_INFO,
139140
client_options=None,
140141
query_options=None,
141-
route_to_leader_enabled=True,
142+
route_to_leader_enabled=False,
142143
):
143144
self._emulator_host = _get_spanner_emulator_host()
144145

tests/unit/spanner_dbapi/test_connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_w_explicit(self, mock_client):
8686
project=PROJECT,
8787
credentials=credentials,
8888
client_info=mock.ANY,
89-
route_to_leader_enabled=True,
89+
route_to_leader_enabled=False,
9090
)
9191
client_info = mock_client.call_args_list[0][1]["client_info"]
9292
self.assertEqual(client_info.user_agent, USER_AGENT)
@@ -120,7 +120,7 @@ def test_w_credential_file_path(self, mock_client):
120120
credentials_path,
121121
project=PROJECT,
122122
client_info=mock.ANY,
123-
route_to_leader_enabled=True,
123+
route_to_leader_enabled=False,
124124
)
125125
client_info = factory.call_args_list[0][1]["client_info"]
126126
self.assertEqual(client_info.user_agent, USER_AGENT)

tests/unit/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _constructor_test_helper(
5959
client_options=None,
6060
query_options=None,
6161
expected_query_options=None,
62-
route_to_leader_enabled=True,
62+
route_to_leader_enabled=None,
6363
):
6464
import google.api_core.client_options
6565
from google.cloud.spanner_v1 import client as MUT

0 commit comments

Comments
 (0)