8000 fix: remove client side gRPC receive limits (#192) · larkee/python-spanner@90effc4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90effc4

Browse files
fix: remove client side gRPC receive limits (googleapis#192)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * fix: remove client recv msg limit fix: add enums to `types/__init__.py` PiperOrigin-RevId: 347055288 Source-Author: Google APIs <noreply@google.com> Source-Date: Fri Dec 11 12:44:37 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: dd372aa22ded7a8ba6f0e03a80e06358a3fa0907 Source-Link: googleapis/googleapis@dd372aa * docs: revert unsupported docstring headers Co-authored-by: larkee <larkee@users.noreply.github.com> Co-authored-by: larkee <31196561+larkee@users.noreply.github.com>
1 parent c000ec4 commit 90effc4

File tree

16 files changed

+98
-28
lines changed

16 files changed

+98
-28
lines changed

google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py

Lines changed: 0 additions & 1 deletion
< 67E6 tr class="diff-line-row">
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = DatabaseAdminGrpcTransport
2929
_transport_registry["grpc_asyncio"] = DatabaseAdminGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"DatabaseAdminTransport",
3433
"DatabaseAdminGrpcTransport",

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ def __init__(
158158
ssl_credentials=ssl_credentials,
159159
scopes=scopes or self.AUTH_SCOPES,
160160
quota_project_id=quota_project_id,
161+
options=[
162+
("grpc.max_send_message_length", -1),
163+
("grpc.max_receive_message_length", -1),
164+
],
161165
)
162166
self._ssl_channel_credentials = ssl_credentials
163167
else:
@@ -176,9 +180,14 @@ def __init__(
176180
ssl_credentials=ssl_channel_credentials,
177181
scopes=scopes or self.AUTH_SCOPES,
178182
quota_project_id=quota_project_id,
183+
options=[
184+
("grpc.max_send_message_length", -1),
185+
("grpc.max_receive_message_length", -1),
186+
],
179187
)
180188

181189
self._stubs = {} # type: Dict[str, Callable]
190+
self._operations_client = None
182191

183192
# Run the base constructor.
184193
super().__init__(
@@ -202,7 +211,7 @@ def create_channel(
202211
) -> grpc.Channel:
203212
"""Create and return a gRPC channel object.
204213
Args:
205-
address (Optionsl[str]): The host for the channel to use.
214+
address (Optional[str]): The host for the channel to use.
206215
credentials (Optional[~.Credentials]): The
207216
authorization credentials to attach to requests. These
208217
credentials identify this application to the service. If
@@ -249,13 +258,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
249258
client.
250259
"""
251260
# Sanity check: Only create a new client if we do not already have one.
252-
if "operations_client" not in self.__dict__:
253-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
254-
self.grpc_channel
255-
)
261+
if self._operations_client is None:
262+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
256263

257264
# Return the client from cache.
258-
return self.__dict__["operations_client"]
265+
return self._operations_client
259266

260267
@property
261268
def list_databases(

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def __init__(
203203
ssl_credentials=ssl_credentials,
204204
scopes=scopes or self.AUTH_SCOPES,
205205
quota_project_id=quota_project_id,
206+
options=[
207+
("grpc.max_send_message_length", -1),
208+
("grpc.max_receive_message_length", -1),
209+
],
206210
)
207211
self._ssl_channel_credentials = ssl_credentials
208212
else:
@@ -221,6 +225,10 @@ def __init__(
221225
ssl_credentials=ssl_channel_credentials,
222226
scopes=scopes or self.AUTH_SCOPES,
223227
quota_project_id=quota_project_id,
228+
options=[
229+
("grpc.max_send_message_length", -1),
230+
("grpc.max_receive_message_length", -1),
231+
],
224232
)
225233

226234
# Run the base constructor.
@@ -234,6 +242,7 @@ def __init__(
234242
)
235243

236244
self._stubs = {}
245+
self._operations_client = None
237246

238247
@property
239248
def grpc_channel(self) -> aio.Channel:
@@ -253,13 +262,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
253262
client.
254263
"""
255264
# Sanity check: Only create a new client if we do not already have one.
256-
if "operations_client" not in self.__dict__:
257-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
265+
if self._operations_client is None:
266+
self._operations_client = operations_v1.OperationsAsyncClient(
258267
self.grpc_channel
259268
)
260269

261270
# Return the client from cache.
262-
return self.__dict__["operations_client"]
271+
return self._operations_client
263272

264273
@property
265274
def list_databases(

google/cloud/spanner_admin_database_v1/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
RestoreDatabaseRequest,
4848
RestoreDatabaseMetadata,
4949
OptimizeRestoredDatabaseMetadata,
50+
RestoreSourceType,
5051
)
5152

52-
5353
__all__ = (
5454
"OperationProgress",
5555
"Backup",
@@ -80,4 +80,5 @@
8080
"RestoreDatabaseRequest",
8181
"RestoreDatabaseMetadata",
8282
"OptimizeRestoredDatabaseMetadata",
83+
"RestoreSourceType",
8384
)

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = InstanceAdminGrpcTransport
2929
_transport_registry["grpc_asyncio"] = InstanceAdminGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"InstanceAdminTransport",
3433
"InstanceAdminGrpcTransport",

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def __init__(
171171
ssl_credentials=ssl_credentials,
172172
scopes=scopes or self.AUTH_SCOPES,
173173
quota_project_id=quota_project_id,
174+
options=[
175+
("grpc.max_send_message_length", -1),
176+
("grpc.max_receive_message_length", -1),
177+
],
174178
)
175179
self._ssl_channel_credentials = ssl_credentials
176180
else:
@@ -189,9 +193,14 @@ def __init__(
189193
ssl_credentials=ssl_channel_credentials,
190194
scopes=scopes or self.AUTH_SCOPES,
191195
quota_project_id=quota_project_id,
196+
options=[
197+
("grpc.max_send_message_length", -1),
198+
("grpc.max_receive_message_length", -1),
199+
],
192200
)
193201

194202
self._stubs = {} # type: Dict[str, Callable]
203+
self._operations_client = None
195204

196205
# Run the base constructor.
197206
super().__init__(
@@ -215,7 +224,7 @@ def create_channel(
215224
) -> grpc.Channel:
216225
"""Create and return a gRPC channel object.
217226
Args:
218-
address (Optionsl[str]): The host for the channel to use.
227+
address (Optional[str]): The host for the channel to use.
219228
credentials (Optional[~.Cr 179B edentials]): The
220229
authorization credentials to attach to requests. These
221230
credentials identify this application to the service. If
@@ -262,13 +271,11 @@ def operations_client(self) -> operations_v1.OperationsClient:
262271
client.
263272
"""
264273
# Sanity check: Only create a new client if we do not already have one.
265-
if "operations_client" not in self.__dict__:
266-
self.__dict__["operations_client"] = operations_v1.OperationsClient(
267-
self.grpc_channel
268-
)
274+
if self._operations_client is None:
275+
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
269276

270277
# Return the client from cache.
271-
return self.__dict__["operations_client"]
278+
return self._operations_client
272279

273280
@property
274281
def list_instance_configs(

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ def __init__(
216216
ssl_credentials=ssl_credentials,
217217
scopes=scopes or self.AUTH_SCOPES,
218218
quota_project_id=quota_project_id,
219+
options=[
220+
("grpc.max_send_message_length", -1),
221+
("grpc.max_receive_message_length", -1),
222+
],
219223
)
220224
self._ssl_channel_credentials = ssl_credentials
221225
else:
@@ -234,6 +238,10 @@ def __init__(
234238
ssl_credentials=ssl_channel_credentials,
235239
scopes=scopes or self.AUTH_SCOPES,
236240
quota_project_id=quota_project_id,
241+
options=[
242+
("grpc.max_send_message_length", -1),
243+
("grpc.max_receive_message_length", -1),
244+
],
237245
)
238246

239247
# Run the base constructor.
@@ -247,6 +255,7 @@ def __init__(
247255
)
248256

249257
self._stubs = {}
258+
self._operations_client = None
250259

251260
@property
252261
def grpc_channel(self) -> aio.Channel:
@@ -266,13 +275,13 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
266275
client.
267276
"""
268277
# Sanity check: Only create a new client if we do not already have one.
269-
if "operations_client" not in self.__dict__:
270-
self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient(
278+
if self._operations_client is None:
279+
self._operations_client = operations_v1.OperationsAsyncClient(
271280
self.grpc_channel
272281
)
273282

274283
# Return the client from cache.
275-
return self.__dict__["operations_client"]
284+
return self._operations_client
276285

277286
@property
278287
def list_instance_configs(

google/cloud/spanner_admin_instance_v1/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
UpdateInstanceMetadata,
3333
)
3434

35-
3635
__all__ = (
3736
"ReplicaInfo",
3837
"InstanceConfig",

google/cloud/spanner_v1/services/spanner/transports/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = SpannerGrpcTransport
2929
_transport_registry["grpc_asyncio"] = SpannerGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"SpannerTransport",
3433
"SpannerGrpcTransport",

google/cloud/spanner_v1/services/spanner/transports/grpc.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ def __init__(
151151
ssl_credentials=ssl_credentials,
152152
scopes=scopes or self.AUTH_SCOPES,
153153
quota_project_id=quota_project_id,
154+
options=[
155+
("grpc.max_send_message_length", -1),
156+
("grpc.max_receive_message_length", -1),
157+
],
154158
)
155159
self._ssl_channel_credentials = ssl_credentials
156160
else:
@@ -169,6 +173,10 @@ def __init__(
169173
ssl_credentials=ssl_channel_credentials,
170174
scopes=scopes or self.AUTH_SCOPES,
171175
quota_project_id=quota_project_id,
176+
options=[
177+
("grpc.max_send_message_length", -1),
178+
("grpc.max_receive_message_length", -1),
179+
],
172180
)
173181

174182
self._stubs = {} # type: Dict[str, Callable]
@@ -195,7 +203,7 @@ def create_channel(
195203
) -> grpc.Channel:
196204
"""Create and return a gRPC channel object.
197205
Args:
198-
address (Optionsl[str]): The host for the channel to use.
206+
address (Optional[str]): The host for the channel to use.
199207
credentials (Optional[~.Credentials]): The
200208
authorization credentials to attach to requests. These
201209
credentials identify this application to the service. If

google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ def __init__(
196196
ssl_credentials=ssl_credentials,
197197
scopes=scopes or self.AUTH_SCOPES,
198198
quota_project_id=quota_project_id,
199+
options=[
200+
("grpc.max_send_message_length", -1),
201+
("grpc.max_receive_message_length", -1),
202+
],
199203
)
200204
self._ssl_channel_credentials = ssl_credentials
201205
else:
@@ -214,6 +218,10 @@ def __init__(
214218
ssl_credentials=ssl_channel_credentials,
215219
scopes=scopes or self.AUTH_SCOPES,
216220
quota_project_id=quota_project_id,
221+
options=[
222+
("grpc.max_send_message_length", -1),
223+
("grpc.max_receive_message_length", -1),
224+
],
217225
)
218226

219227
# Run the base constructor.

google/cloud/spanner_v1/types/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from .type import (
3333
Type,
3434
StructType,
35+
TypeCode,
3536
)
3637
from .result_set import (
3738
ResultSet,
@@ -63,7 +64,6 @@
6364
RollbackRequest,
6465
)
6566

66-
6767
__all__ = (
6868
"KeyRange",
6969
"KeySet",
@@ -75,6 +75,7 @@
7575
"TransactionSelector",
7676
"Type",
7777
"StructType",
78+
"TypeCode",
7879
"ResultSet",
7980
"PartialResultSet",
8081
"ResultSetMetadata",

synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-spanner.git",
7-
"sha": "af5a3c65fbf81a93c1b4d4a8a9f65f06e96df325"
7+
"sha": "2faf01b135360586ef27c66976646593fd85fd1e"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "53eb2512a55caabcbad1898225080a2a3dfcb6aa",
15-
"internalRef": "346818879"
14+
"sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907",
15+
"internalRef": "347055288"
1616
}
1717
},
1818
{

tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4784,6 +4784,10 @@ def test_database_admin_transport_channel_mtls_with_client_cert_source(transport
47844784
),
47854785 4E34
ssl_credentials=mock_ssl_cred,
47864786
quota_project_id=None,
4787+
options=[
4788+
("grpc.max_send_message_length", -1),
4789+
("grpc.max_receive_message_length", -1),
4790+
],
47874791
)
47884792
assert transport.grpc_channel == mock_grpc_channel
47894793
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -4828,6 +4832,10 @@ def test_database_admin_transport_channel_mtls_with_adc(transport_class):
48284832
),
48294833
ssl_credentials=mock_ssl_cred,
48304834
quota_project_id=None,
4835+
options=[
4836+
("grpc.max_send_message_length", -1),
4837+
("grpc.max_receive_message_length", -1),
4838+
],
48314839
)
48324840
assert transport.grpc_channel == mock_grpc_channel
48334841

tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,6 +3141,10 @@ def test_instance_admin_transport_channel_mtls_with_client_cert_source(transport
31413141
),
31423142
ssl_credentials=mock_ssl_cred,
31433143
quota_project_id=None,
3144+
options=[
3145+
("grpc.max_send_message_length", -1),
3146+
("grpc.max_receive_message_length", -1),
3147+
],
31443148
)
31453149
assert transport.grpc_channel == mock_grpc_channel
31463150
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -3185,6 +3189,10 @@ def test_instance_admin_transport_channel_mtls_with_adc(transport_class):
31853189
),
31863190
ssl_credentials=mock_ssl_cred,
31873191
quota_project_id=None,
3192+
options=[
3193+
("grpc.max_send_message_length", -1),
3194+
("grpc.max_receive_message_length", -1),
3195+
],
31883196
)
31893197
assert transport.grpc_channel == mock_grpc_channel
31903198

0 commit comments

Comments
 (0)
0