File tree Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -508,7 +508,7 @@ def connect(
508508 pool = None ,
509509 user_agent = None ,
510510 client = None ,
511- route_to_leader_enabled = False ,
511+ route_to_leader_enabled = True ,
512512):
513513 """Creates a connection to a Google Cloud Spanner database.
514514
@@ -547,10 +547,9 @@ def connect(
547547
548548 :type route_to_leader_enabled: boolean
549549 :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.
554553
555554
556555 :rtype: :class:`google.cloud.spanner_dbapi.connection.Connection`
@@ -568,14 +567,14 @@ def connect(
568567 credentials ,
569568 project = project ,
570569 client_info = client_info ,
571- route_to_leader_enabled = False ,
570+ route_to_leader_enabled = True ,
572571 )
573572 else :
574573 client = spanner .Client (
575574 project = project ,
576575 credentials = credentials ,
577576 client_info = client_info ,
578- route_to_leader_enabled = False ,
577+ route_to_leader_enabled = True ,
579578 )
580579 else :
581580 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):
116116
117117 :type route_to_leader_enabled: boolean
118118 :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.
123122
124123 :raises: :class:`ValueError <exceptions.ValueError>` if both ``read_only``
125124 and ``admin`` are :data:`True`
@@ -139,7 +138,7 @@ def __init__(
139138 client_info = _CLIENT_INFO ,
140139 client_options = None ,
141140 query_options = None ,
142- route_to_leader_enabled = False ,
141+ route_to_leader_enabled = True ,
143142 ):
144143 self ._emulator_host = _get_spanner_emulator_host ()
145144
Original file line number Diff line number Diff 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 = False ,
89+ route_to_leader_enabled = True ,
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 = False ,
123+ route_to_leader_enabled = True ,
124124 )
125125 client_info = factory .call_args_list [0 ][1 ]["client_info" ]
126126 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(
5959 client_options = None ,
6060 query_options = None ,
6161 expected_query_options = None ,
62- route_to_leader_enabled = None ,
62+ route_to_leader_enabled = True ,
6363 ):
6464 import google .api_core .client_options
6565 from google .cloud .spanner_v1 import client as MUT
You can’t perform that action at this time.
0 commit comments