FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Revert "feat: Set LAR as False (#980)" by surbhigarg92 · Pull Request #992 · googleapis/python-spanner · GitHub

This repository was archived by the owner on Jun 8, 2026. It is now read-only.
/ python-spanner Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 6 additions & 7 deletions google/cloud/spanner_dbapi/connection.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def connect(
pool=None,
user_agent=None,
client=None,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
):
"""Creates a connection to a Google Cloud Spanner database.

Expand Down Expand Up @@ -547,10 +547,9 @@ def connect(

:type route_to_leader_enabled: boolean
:param route_to_leader_enabled:
(Optional) Default False. Set route_to_leader_enabled as True to
enable leader aware routing. Enabling leader aware routing
would route all requests in RW/PDML transactions to the
leader region.
(Optional) Default True. Set route_to_leader_enabled as False to
disable leader aware routing. Disabling leader aware routing would
route all requests in RW/PDML transactions to the closest region.


:rtype: :class:`google.cloud.spanner_dbapi.connection.Connection`
Expand All @@ -568,14 +567,14 @@ def connect(
credentials,
project=project,
client_info=client_info,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
)
else:
client = spanner.Client(
project=project,
credentials=credentials,
client_info=client_info,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
)
else:
if project is not None and client.project != project:
Expand Down
9 changes: 4 additions & 5 deletions google/cloud/spanner_v1/client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ class Client(ClientWithProject):

:type route_to_leader_enabled: boolean
:param route_to_leader_enabled:
(Optional) Default False. Set route_to_leader_enabled as True to
enable leader aware routing. Enabling leader aware routing
would route all requests in RW/PDML transactions to the
leader region.
(Optional) Default True. Set route_to_leader_enabled as False to
disable leader aware routing. Disabling leader aware routing would
route all requests in RW/PDML transactions to the closest region.

:raises: :class:`ValueError <exceptions.ValueError>` if both ``read_only``
and ``admin`` are :data:`True`
Expand All @@ -139,7 +138,7 @@ def __init__(
client_info=_CLIENT_INFO,
client_options=None,
query_options=None,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
):
self._emulator_host = _get_spanner_emulator_host()

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/spanner_dbapi/test_connect.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_w_explicit(self, mock_client):
project=PROJECT,
credentials=credentials,
client_info=mock.ANY,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
)
client_info = mock_client.call_args_list[0][1]["client_info"]
self.assertEqual(client_info.user_agent, USER_AGENT)
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_w_credential_file_path(self, mock_client):
credentials_path,
project=PROJECT,
client_info=mock.ANY,
route_to_leader_enabled=False,
route_to_leader_enabled=True,
)
client_info = factory.call_args_list[0][1]["client_info"]
self.assertEqual(client_info.user_agent, USER_AGENT)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _constructor_test_helper(
client_options=None,
query_options=None,
expected_query_options=None,
route_to_leader_enabled=None,
route_to_leader_enabled=True,
):
import google.api_core.client_options
from google.cloud.spanner_v1 import client as MUT
Expand Down

Back | FazBrowse Home | New Git URL