google-cloud-spanner 3.55.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/cloud/spanner.py +47 -0
- google/cloud/spanner_admin_database_v1/__init__.py +146 -0
- google/cloud/spanner_admin_database_v1/gapic_metadata.json +418 -0
- google/cloud/spanner_admin_database_v1/gapic_version.py +16 -0
- google/cloud/spanner_admin_database_v1/py.typed +2 -0
- google/cloud/spanner_admin_database_v1/services/__init__.py +15 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py +22 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py +4097 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/client.py +4602 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py +989 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py +38 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py +820 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py +1303 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py +1688 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest.py +6512 -0
- google/cloud/spanner_admin_database_v1/services/database_admin/transports/rest_base.py +1650 -0
- google/cloud/spanner_admin_database_v1/types/__init__.py +144 -0
- google/cloud/spanner_admin_database_v1/types/backup.py +1106 -0
- google/cloud/spanner_admin_database_v1/types/backup_schedule.py +369 -0
- google/cloud/spanner_admin_database_v1/types/common.py +180 -0
- google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py +1303 -0
- google/cloud/spanner_admin_instance_v1/__init__.py +110 -0
- google/cloud/spanner_admin_instance_v1/gapic_metadata.json +343 -0
- google/cloud/spanner_admin_instance_v1/gapic_version.py +16 -0
- google/cloud/spanner_admin_instance_v1/py.typed +2 -0
- google/cloud/spanner_admin_instance_v1/services/__init__.py +15 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py +22 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py +3466 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py +3881 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py +856 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py +38 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py +545 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py +1347 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py +1539 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py +4834 -0
- google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest_base.py +1198 -0
- google/cloud/spanner_admin_instance_v1/types/__init__.py +104 -0
- google/cloud/spanner_admin_instance_v1/types/common.py +99 -0
- google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py +2375 -0
- google/cloud/spanner_dbapi/__init__.py +93 -0
- google/cloud/spanner_dbapi/_helpers.py +113 -0
- google/cloud/spanner_dbapi/batch_dml_executor.py +135 -0
- google/cloud/spanner_dbapi/checksum.py +80 -0
- google/cloud/spanner_dbapi/client_side_statement_executor.py +140 -0
- google/cloud/spanner_dbapi/client_side_statement_parser.py +106 -0
- google/cloud/spanner_dbapi/connection.py +818 -0
- google/cloud/spanner_dbapi/cursor.py +609 -0
- google/cloud/spanner_dbapi/exceptions.py +172 -0
- google/cloud/spanner_dbapi/parse_utils.py +392 -0
- google/cloud/spanner_dbapi/parsed_statement.py +63 -0
- google/cloud/spanner_dbapi/parser.py +258 -0
- google/cloud/spanner_dbapi/partition_helper.py +41 -0
- google/cloud/spanner_dbapi/transaction_helper.py +294 -0
- google/cloud/spanner_dbapi/types.py +106 -0
- google/cloud/spanner_dbapi/utils.py +147 -0
- google/cloud/spanner_dbapi/version.py +20 -0
- google/cloud/spanner_v1/__init__.py +154 -0
- google/cloud/spanner_v1/_helpers.py +751 -0
- google/cloud/spanner_v1/_opentelemetry_tracing.py +165 -0
- google/cloud/spanner_v1/backup.py +397 -0
- google/cloud/spanner_v1/batch.py +433 -0
- google/cloud/spanner_v1/client.py +538 -0
- google/cloud/spanner_v1/data_types.py +350 -0
- google/cloud/spanner_v1/database.py +1968 -0
- google/cloud/spanner_v1/database_sessions_manager.py +249 -0
- google/cloud/spanner_v1/gapic_metadata.json +268 -0
- google/cloud/spanner_v1/gapic_version.py +16 -0
- google/cloud/spanner_v1/instance.py +735 -0
- google/cloud/spanner_v1/keyset.py +193 -0
- google/cloud/spanner_v1/merged_result_set.py +146 -0
- google/cloud/spanner_v1/metrics/constants.py +71 -0
- google/cloud/spanner_v1/metrics/metrics_capture.py +75 -0
- google/cloud/spanner_v1/metrics/metrics_exporter.py +384 -0
- google/cloud/spanner_v1/metrics/metrics_interceptor.py +156 -0
- google/cloud/spanner_v1/metrics/metrics_tracer.py +588 -0
- google/cloud/spanner_v1/metrics/metrics_tracer_factory.py +328 -0
- google/cloud/spanner_v1/metrics/spanner_metrics_tracer_factory.py +172 -0
- google/cloud/spanner_v1/param_types.py +110 -0
- google/cloud/spanner_v1/pool.py +813 -0
- google/cloud/spanner_v1/py.typed +2 -0
- google/cloud/spanner_v1/request_id_header.py +64 -0
- google/cloud/spanner_v1/services/__init__.py +15 -0
- google/cloud/spanner_v1/services/spanner/__init__.py +22 -0
- google/cloud/spanner_v1/services/spanner/async_client.py +2205 -0
- google/cloud/spanner_v1/services/spanner/client.py +2624 -0
- google/cloud/spanner_v1/services/spanner/pagers.py +196 -0
- google/cloud/spanner_v1/services/spanner/transports/__init__.py +38 -0
- google/cloud/spanner_v1/services/spanner/transports/base.py +520 -0
- google/cloud/spanner_v1/services/spanner/transports/grpc.py +911 -0
- google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py +1144 -0
- google/cloud/spanner_v1/services/spanner/transports/rest.py +3468 -0
- google/cloud/spanner_v1/services/spanner/transports/rest_base.py +981 -0
- google/cloud/spanner_v1/session.py +631 -0
- google/cloud/spanner_v1/session_options.py +133 -0
- google/cloud/spanner_v1/snapshot.py +1057 -0
- google/cloud/spanner_v1/streamed.py +402 -0
- google/cloud/spanner_v1/table.py +181 -0
- google/cloud/spanner_v1/testing/__init__.py +0 -0
- google/cloud/spanner_v1/testing/database_test.py +121 -0
- google/cloud/spanner_v1/testing/interceptors.py +118 -0
- google/cloud/spanner_v1/testing/mock_database_admin.py +38 -0
- google/cloud/spanner_v1/testing/mock_spanner.py +261 -0
- google/cloud/spanner_v1/testing/spanner_database_admin_pb2_grpc.py +1267 -0
- google/cloud/spanner_v1/testing/spanner_pb2_grpc.py +882 -0
- google/cloud/spanner_v1/transaction.py +747 -0
- google/cloud/spanner_v1/types/__init__.py +118 -0
- google/cloud/spanner_v1/types/commit_response.py +94 -0
- google/cloud/spanner_v1/types/keys.py +248 -0
- google/cloud/spanner_v1/types/mutation.py +201 -0
- google/cloud/spanner_v1/types/query_plan.py +220 -0
- google/cloud/spanner_v1/types/result_set.py +379 -0
- google/cloud/spanner_v1/types/spanner.py +1815 -0
- google/cloud/spanner_v1/types/transaction.py +818 -0
- google/cloud/spanner_v1/types/type.py +288 -0
- google_cloud_spanner-3.55.0.dist-info/LICENSE +202 -0
- google_cloud_spanner-3.55.0.dist-info/METADATA +318 -0
- google_cloud_spanner-3.55.0.dist-info/RECORD +119 -0
- google_cloud_spanner-3.55.0.dist-info/WHEEL +5 -0
- google_cloud_spanner-3.55.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1144 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2025 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
import inspect
|
|
17
|
+
import json
|
|
18
|
+
import pickle
|
|
19
|
+
import logging as std_logging
|
|
20
|
+
import warnings
|
|
21
|
+
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
|
|
22
|
+
|
|
23
|
+
from google.api_core import gapic_v1
|
|
24
|
+
from google.api_core import grpc_helpers_async
|
|
25
|
+
from google.api_core import exceptions as core_exceptions
|
|
26
|
+
from google.api_core import retry_async as retries
|
|
27
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
28
|
+
from google.auth.transport.grpc import SslCredentials # type: ignore
|
|
29
|
+
from google.protobuf.json_format import MessageToJson
|
|
30
|
+
import google.protobuf.message
|
|
31
|
+
|
|
32
|
+
import grpc # type: ignore
|
|
33
|
+
import proto # type: ignore
|
|
34
|
+
from grpc.experimental import aio # type: ignore
|
|
35
|
+
|
|
36
|
+
from google.cloud.spanner_v1.types import commit_response
|
|
37
|
+
from google.cloud.spanner_v1.types import result_set
|
|
38
|
+
from google.cloud.spanner_v1.types import spanner
|
|
39
|
+
from google.cloud.spanner_v1.types import transaction
|
|
40
|
+
from google.cloud.spanner_v1.metrics.metrics_interceptor import MetricsInterceptor
|
|
41
|
+
from google.protobuf import empty_pb2 # type: ignore
|
|
42
|
+
from .base import SpannerTransport, DEFAULT_CLIENT_INFO
|
|
43
|
+
from .grpc import SpannerGrpcTransport
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
from google.api_core import client_logging # type: ignore
|
|
47
|
+
|
|
48
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
49
|
+
except ImportError: # pragma: NO COVER
|
|
50
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
51
|
+
|
|
52
|
+
_LOGGER = std_logging.getLogger(__name__)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class _LoggingClientAIOInterceptor(
|
|
56
|
+
grpc.aio.UnaryUnaryClientInterceptor
|
|
57
|
+
): # pragma: NO COVER
|
|
58
|
+
async def intercept_unary_unary(self, continuation, client_call_details, request):
|
|
59
|
+
logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
60
|
+
std_logging.DEBUG
|
|
61
|
+
)
|
|
62
|
+
if logging_enabled: # pragma: NO COVER
|
|
63
|
+
request_metadata = client_call_details.metadata
|
|
64
|
+
if isinstance(request, proto.Message):
|
|
65
|
+
request_payload = type(request).to_json(request)
|
|
66
|
+
elif isinstance(request, google.protobuf.message.Message):
|
|
67
|
+
request_payload = MessageToJson(request)
|
|
68
|
+
else:
|
|
69
|
+
request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
|
|
70
|
+
|
|
71
|
+
request_metadata = {
|
|
72
|
+
key: value.decode("utf-8") if isinstance(value, bytes) else value
|
|
73
|
+
for key, value in request_metadata
|
|
74
|
+
}
|
|
75
|
+
grpc_request = {
|
|
76
|
+
"payload": request_payload,
|
|
77
|
+
"requestMethod": "grpc",
|
|
78
|
+
"metadata": dict(request_metadata),
|
|
79
|
+
}
|
|
80
|
+
_LOGGER.debug(
|
|
81
|
+
f"Sending request for {client_call_details.method}",
|
|
82
|
+
extra={
|
|
83
|
+
"serviceName": "google.spanner.v1.Spanner",
|
|
84
|
+
"rpcName": str(client_call_details.method),
|
|
85
|
+
"request": grpc_request,
|
|
86
|
+
"metadata": grpc_request["metadata"],
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
response = await continuation(client_call_details, request)
|
|
90
|
+
if logging_enabled: # pragma: NO COVER
|
|
91
|
+
response_metadata = await response.trailing_metadata()
|
|
92
|
+
# Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
|
|
93
|
+
metadata = (
|
|
94
|
+
dict([(k, str(v)) for k, v in response_metadata])
|
|
95
|
+
if response_metadata
|
|
96
|
+
else None
|
|
97
|
+
)
|
|
98
|
+
result = await response
|
|
99
|
+
if isinstance(result, proto.Message):
|
|
100
|
+
response_payload = type(result).to_json(result)
|
|
101
|
+
elif isinstance(result, google.protobuf.message.Message):
|
|
102
|
+
response_payload = MessageToJson(result)
|
|
103
|
+
else:
|
|
104
|
+
response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
|
|
105
|
+
grpc_response = {
|
|
106
|
+
"payload": response_payload,
|
|
107
|
+
"metadata": metadata,
|
|
108
|
+
"status": "OK",
|
|
109
|
+
}
|
|
110
|
+
_LOGGER.debug(
|
|
111
|
+
f"Received response to rpc {client_call_details.method}.",
|
|
112
|
+
extra={
|
|
113
|
+
"serviceName": "google.spanner.v1.Spanner",
|
|
114
|
+
"rpcName": str(client_call_details.method),
|
|
115
|
+
"response": grpc_response,
|
|
116
|
+
"metadata": grpc_response["metadata"],
|
|
117
|
+
},
|
|
118
|
+
)
|
|
119
|
+
return response
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class SpannerGrpcAsyncIOTransport(SpannerTransport):
|
|
123
|
+
"""gRPC AsyncIO backend transport for Spanner.
|
|
124
|
+
|
|
125
|
+
Cloud Spanner API
|
|
126
|
+
|
|
127
|
+
The Cloud Spanner API can be used to manage sessions and execute
|
|
128
|
+
transactions on data stored in Cloud Spanner databases.
|
|
129
|
+
|
|
130
|
+
This class defines the same methods as the primary client, so the
|
|
131
|
+
primary client can load the underlying transport implementation
|
|
132
|
+
and call it.
|
|
133
|
+
|
|
134
|
+
It sends protocol buffers over the wire using gRPC (which is built on
|
|
135
|
+
top of HTTP/2); the ``grpcio`` package must be installed.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
_grpc_channel: aio.Channel
|
|
139
|
+
_stubs: Dict[str, Callable] = {}
|
|
140
|
+
|
|
141
|
+
@classmethod
|
|
142
|
+
def create_channel(
|
|
143
|
+
cls,
|
|
144
|
+
host: str = "spanner.googleapis.com",
|
|
145
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
146
|
+
credentials_file: Optional[str] = None,
|
|
147
|
+
scopes: Optional[Sequence[str]] = None,
|
|
148
|
+
quota_project_id: Optional[str] = None,
|
|
149
|
+
**kwargs,
|
|
150
|
+
) -> aio.Channel:
|
|
151
|
+
"""Create and return a gRPC AsyncIO channel object.
|
|
152
|
+
Args:
|
|
153
|
+
host (Optional[str]): The host for the channel to use.
|
|
154
|
+
credentials (Optional[~.Credentials]): The
|
|
155
|
+
authorization credentials to attach to requests. These
|
|
156
|
+
credentials identify this application to the service. If
|
|
157
|
+
none are specified, the client will attempt to ascertain
|
|
158
|
+
the credentials from the environment.
|
|
159
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
160
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
161
|
+
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
|
|
162
|
+
service. These are only used when credentials are not specified and
|
|
163
|
+
are passed to :func:`google.auth.default`.
|
|
164
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
165
|
+
and quota.
|
|
166
|
+
kwargs (Optional[dict]): Keyword arguments, which are passed to the
|
|
167
|
+
channel creation.
|
|
168
|
+
Returns:
|
|
169
|
+
aio.Channel: A gRPC AsyncIO channel object.
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
return grpc_helpers_async.create_channel(
|
|
173
|
+
host,
|
|
174
|
+
credentials=credentials,
|
|
175
|
+
credentials_file=credentials_file,
|
|
176
|
+
quota_project_id=quota_project_id,
|
|
177
|
+
default_scopes=cls.AUTH_SCOPES,
|
|
178
|
+
scopes=scopes,
|
|
179
|
+
default_host=cls.DEFAULT_HOST,
|
|
180
|
+
**kwargs,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def __init__(
|
|
184
|
+
self,
|
|
185
|
+
*,
|
|
186
|
+
host: str = "spanner.googleapis.com",
|
|
187
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
188
|
+
credentials_file: Optional[str] = None,
|
|
189
|
+
scopes: Optional[Sequence[str]] = None,
|
|
190
|
+
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
|
|
191
|
+
api_mtls_endpoint: Optional[str] = None,
|
|
192
|
+
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
193
|
+
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
|
|
194
|
+
client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
|
|
195
|
+
quota_project_id: Optional[str] = None,
|
|
196
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
197
|
+
always_use_jwt_access: Optional[bool] = False,
|
|
198
|
+
api_audience: Optional[str] = None,
|
|
199
|
+
metrics_interceptor: Optional[MetricsInterceptor] = None,
|
|
200
|
+
) -> None:
|
|
201
|
+
"""Instantiate the transport.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
host (Optional[str]):
|
|
205
|
+
The hostname to connect to (default: 'spanner.googleapis.com').
|
|
206
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
207
|
+
authorization credentials to attach to requests. These
|
|
208
|
+
credentials identify the application to the service; if none
|
|
209
|
+
are specified, the client will attempt to ascertain the
|
|
210
|
+
credentials from the environment.
|
|
211
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
212
|
+
credentials_file (Optional[str]): A file with credentials that can
|
|
213
|
+
be loaded with :func:`google.auth.load_credentials_from_file`.
|
|
214
|
+
This argument is ignored if a ``channel`` instance is provided.
|
|
215
|
+
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
|
|
216
|
+
service. These are only used when credentials are not specified and
|
|
217
|
+
are passed to :func:`google.auth.default`.
|
|
218
|
+
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
|
|
219
|
+
A ``Channel`` instance through which to make calls, or a Callable
|
|
220
|
+
that constructs and returns one. If set to None, ``self.create_channel``
|
|
221
|
+
is used to create the channel. If a Callable is given, it will be called
|
|
222
|
+
with the same arguments as used in ``self.create_channel``.
|
|
223
|
+
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
|
|
224
|
+
If provided, it overrides the ``host`` argument and tries to create
|
|
225
|
+
a mutual TLS channel with client SSL credentials from
|
|
226
|
+
``client_cert_source`` or application default SSL credentials.
|
|
227
|
+
client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
228
|
+
Deprecated. A callback to provide client SSL certificate bytes and
|
|
229
|
+
private key bytes, both in PEM format. It is ignored if
|
|
230
|
+
``api_mtls_endpoint`` is None.
|
|
231
|
+
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
|
|
232
|
+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
|
|
233
|
+
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
|
|
234
|
+
A callback to provide client certificate bytes and private key bytes,
|
|
235
|
+
both in PEM format. It is used to configure a mutual TLS channel. It is
|
|
236
|
+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
|
|
237
|
+
quota_project_id (Optional[str]): An optional project to use for billing
|
|
238
|
+
and quota.
|
|
239
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
240
|
+
The client info used to send a user-agent string along with
|
|
241
|
+
API requests. If ``None``, then default info will be used.
|
|
242
|
+
Generally, you only need to set this if you're developing
|
|
243
|
+
your own client library.
|
|
244
|
+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
|
|
245
|
+
be used for service account credentials.
|
|
246
|
+
|
|
247
|
+
Raises:
|
|
248
|
+
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
|
|
249
|
+
creation failed for any reason.
|
|
250
|
+
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
|
|
251
|
+
and ``credentials_file`` are passed.
|
|
252
|
+
"""
|
|
253
|
+
self._grpc_channel = None
|
|
254
|
+
self._ssl_channel_credentials = ssl_channel_credentials
|
|
255
|
+
self._stubs: Dict[str, Callable] = {}
|
|
256
|
+
|
|
257
|
+
if api_mtls_endpoint:
|
|
258
|
+
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
|
|
259
|
+
if client_cert_source:
|
|
260
|
+
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
|
|
261
|
+
|
|
262
|
+
if isinstance(channel, aio.Channel):
|
|
263
|
+
# Ignore credentials if a channel was passed.
|
|
264
|
+
credentials = None
|
|
265
|
+
self._ignore_credentials = True
|
|
266
|
+
# If a channel was explicitly provided, set it.
|
|
267
|
+
self._grpc_channel = channel
|
|
268
|
+
self._ssl_channel_credentials = None
|
|
269
|
+
else:
|
|
270
|
+
if api_mtls_endpoint:
|
|
271
|
+
host = api_mtls_endpoint
|
|
272
|
+
|
|
273
|
+
# Create SSL credentials with client_cert_source or application
|
|
274
|
+
# default SSL credentials.
|
|
275
|
+
if client_cert_source:
|
|
276
|
+
cert, key = client_cert_source()
|
|
277
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
278
|
+
certificate_chain=cert, private_key=key
|
|
279
|
+
)
|
|
280
|
+
else:
|
|
281
|
+
self._ssl_channel_credentials = SslCredentials().ssl_credentials
|
|
282
|
+
|
|
283
|
+
else:
|
|
284
|
+
if client_cert_source_for_mtls and not ssl_channel_credentials:
|
|
285
|
+
cert, key = client_cert_source_for_mtls()
|
|
286
|
+
self._ssl_channel_credentials = grpc.ssl_channel_credentials(
|
|
287
|
+
certificate_chain=cert, private_key=key
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
# The base transport sets the host, credentials and scopes
|
|
291
|
+
super().__init__(
|
|
292
|
+
host=host,
|
|
293
|
+
credentials=credentials,
|
|
294
|
+
credentials_file=credentials_file,
|
|
295
|
+
scopes=scopes,
|
|
296
|
+
quota_project_id=quota_project_id,
|
|
297
|
+
client_info=client_info,
|
|
298
|
+
always_use_jwt_access=always_use_jwt_access,
|
|
299
|
+
api_audience=api_audience,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
if not self._grpc_channel:
|
|
303
|
+
# initialize with the provided callable or the default channel
|
|
304
|
+
channel_init = channel or type(self).create_channel
|
|
305
|
+
self._grpc_channel = channel_init(
|
|
306
|
+
self._host,
|
|
307
|
+
# use the credentials which are saved
|
|
308
|
+
credentials=self._credentials,
|
|
309
|
+
# Set ``credentials_file`` to ``None`` here as
|
|
310
|
+
# the credentials that we saved earlier should be used.
|
|
311
|
+
credentials_file=None,
|
|
312
|
+
scopes=self._scopes,
|
|
313
|
+
ssl_credentials=self._ssl_channel_credentials,
|
|
314
|
+
quota_project_id=quota_project_id,
|
|
315
|
+
options=[
|
|
316
|
+
("grpc.max_send_message_length", -1),
|
|
317
|
+
("grpc.max_receive_message_length", -1),
|
|
318
|
+
],
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
self._interceptor = _LoggingClientAIOInterceptor()
|
|
322
|
+
self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
|
|
323
|
+
self._logged_channel = self._grpc_channel
|
|
324
|
+
self._wrap_with_kind = (
|
|
325
|
+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
|
|
326
|
+
)
|
|
327
|
+
# Wrap messages. This must be done after self._logged_channel exists
|
|
328
|
+
self._prep_wrapped_messages(client_info)
|
|
329
|
+
|
|
330
|
+
@property
|
|
331
|
+
def grpc_channel(self) -> aio.Channel:
|
|
332
|
+
"""Create the channel designed to connect to this service.
|
|
333
|
+
|
|
334
|
+
This property caches on the instance; repeated calls return
|
|
335
|
+
the same channel.
|
|
336
|
+
"""
|
|
337
|
+
# Return the channel from cache.
|
|
338
|
+
return self._grpc_channel
|
|
339
|
+
|
|
340
|
+
@property
|
|
341
|
+
def create_session(
|
|
342
|
+
self,
|
|
343
|
+
) -> Callable[[spanner.CreateSessionRequest], Awaitable[spanner.Session]]:
|
|
344
|
+
r"""Return a callable for the create session method over gRPC.
|
|
345
|
+
|
|
346
|
+
Creates a new session. A session can be used to perform
|
|
347
|
+
transactions that read and/or modify data in a Cloud Spanner
|
|
348
|
+
database. Sessions are meant to be reused for many consecutive
|
|
349
|
+
transactions.
|
|
350
|
+
|
|
351
|
+
Sessions can only execute one transaction at a time. To execute
|
|
352
|
+
multiple concurrent read-write/write-only transactions, create
|
|
353
|
+
multiple sessions. Note that standalone reads and queries use a
|
|
354
|
+
transaction internally, and count toward the one transaction
|
|
355
|
+
limit.
|
|
356
|
+
|
|
357
|
+
Active sessions use additional server resources, so it is a good
|
|
358
|
+
idea to delete idle and unneeded sessions. Aside from explicit
|
|
359
|
+
deletes, Cloud Spanner may delete sessions for which no
|
|
360
|
+
operations are sent for more than an hour. If a session is
|
|
361
|
+
deleted, requests to it return ``NOT_FOUND``.
|
|
362
|
+
|
|
363
|
+
Idle sessions can be kept alive by sending a trivial SQL query
|
|
364
|
+
periodically, e.g., ``"SELECT 1"``.
|
|
365
|
+
|
|
366
|
+
Returns:
|
|
367
|
+
Callable[[~.CreateSessionRequest],
|
|
368
|
+
Awaitable[~.Session]]:
|
|
369
|
+
A function that, when called, will call the underlying RPC
|
|
370
|
+
on the server.
|
|
371
|
+
"""
|
|
372
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
373
|
+
# the request.
|
|
374
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
375
|
+
# to pass in the functions for each.
|
|
376
|
+
if "create_session" not in self._stubs:
|
|
377
|
+
self._stubs["create_session"] = self._logged_channel.unary_unary(
|
|
378
|
+
"/google.spanner.v1.Spanner/CreateSession",
|
|
379
|
+
request_serializer=spanner.CreateSessionRequest.serialize,
|
|
380
|
+
response_deserializer=spanner.Session.deserialize,
|
|
381
|
+
)
|
|
382
|
+
return self._stubs["create_session"]
|
|
383
|
+
|
|
384
|
+
@property
|
|
385
|
+
def batch_create_sessions(
|
|
386
|
+
self,
|
|
387
|
+
) -> Callable[
|
|
388
|
+
[spanner.BatchCreateSessionsRequest],
|
|
389
|
+
Awaitable[spanner.BatchCreateSessionsResponse],
|
|
390
|
+
]:
|
|
391
|
+
r"""Return a callable for the batch create sessions method over gRPC.
|
|
392
|
+
|
|
393
|
+
Creates multiple new sessions.
|
|
394
|
+
|
|
395
|
+
This API can be used to initialize a session cache on
|
|
396
|
+
the clients. See https://goo.gl/TgSFN2 for best
|
|
397
|
+
practices on session cache management.
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
Callable[[~.BatchCreateSessionsRequest],
|
|
401
|
+
Awaitable[~.BatchCreateSessionsResponse]]:
|
|
402
|
+
A function that, when called, will call the underlying RPC
|
|
403
|
+
on the server.
|
|
404
|
+
"""
|
|
405
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
406
|
+
# the request.
|
|
407
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
408
|
+
# to pass in the functions for each.
|
|
409
|
+
if "batch_create_sessions" not in self._stubs:
|
|
410
|
+
self._stubs["batch_create_sessions"] = self._logged_channel.unary_unary(
|
|
411
|
+
"/google.spanner.v1.Spanner/BatchCreateSessions",
|
|
412
|
+
request_serializer=spanner.BatchCreateSessionsRequest.serialize,
|
|
413
|
+
response_deserializer=spanner.BatchCreateSessionsResponse.deserialize,
|
|
414
|
+
)
|
|
415
|
+
return self._stubs["batch_create_sessions"]
|
|
416
|
+
|
|
417
|
+
@property
|
|
418
|
+
def get_session(
|
|
419
|
+
self,
|
|
420
|
+
) -> Callable[[spanner.GetSessionRequest], Awaitable[spanner.Session]]:
|
|
421
|
+
r"""Return a callable for the get session method over gRPC.
|
|
422
|
+
|
|
423
|
+
Gets a session. Returns ``NOT_FOUND`` if the session does not
|
|
424
|
+
exist. This is mainly useful for determining whether a session
|
|
425
|
+
is still alive.
|
|
426
|
+
|
|
427
|
+
Returns:
|
|
428
|
+
Callable[[~.GetSessionRequest],
|
|
429
|
+
Awaitable[~.Session]]:
|
|
430
|
+
A function that, when called, will call the underlying RPC
|
|
431
|
+
on the server.
|
|
432
|
+
"""
|
|
433
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
434
|
+
# the request.
|
|
435
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
436
|
+
# to pass in the functions for each.
|
|
437
|
+
if "get_session" not in self._stubs:
|
|
438
|
+
self._stubs["get_session"] = self._logged_channel.unary_unary(
|
|
439
|
+
"/google.spanner.v1.Spanner/GetSession",
|
|
440
|
+
request_serializer=spanner.GetSessionRequest.serialize,
|
|
441
|
+
response_deserializer=spanner.Session.deserialize,
|
|
442
|
+
)
|
|
443
|
+
return self._stubs["get_session"]
|
|
444
|
+
|
|
445
|
+
@property
|
|
446
|
+
def list_sessions(
|
|
447
|
+
self,
|
|
448
|
+
) -> Callable[
|
|
449
|
+
[spanner.ListSessionsRequest], Awaitable[spanner.ListSessionsResponse]
|
|
450
|
+
]:
|
|
451
|
+
r"""Return a callable for the list sessions method over gRPC.
|
|
452
|
+
|
|
453
|
+
Lists all sessions in a given database.
|
|
454
|
+
|
|
455
|
+
Returns:
|
|
456
|
+
Callable[[~.ListSessionsRequest],
|
|
457
|
+
Awaitable[~.ListSessionsResponse]]:
|
|
458
|
+
A function that, when called, will call the underlying RPC
|
|
459
|
+
on the server.
|
|
460
|
+
"""
|
|
461
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
462
|
+
# the request.
|
|
463
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
464
|
+
# to pass in the functions for each.
|
|
465
|
+
if "list_sessions" not in self._stubs:
|
|
466
|
+
self._stubs["list_sessions"] = self._logged_channel.unary_unary(
|
|
467
|
+
"/google.spanner.v1.Spanner/ListSessions",
|
|
468
|
+
request_serializer=spanner.ListSessionsRequest.serialize,
|
|
469
|
+
response_deserializer=spanner.ListSessionsResponse.deserialize,
|
|
470
|
+
)
|
|
471
|
+
return self._stubs["list_sessions"]
|
|
472
|
+
|
|
473
|
+
@property
|
|
474
|
+
def delete_session(
|
|
475
|
+
self,
|
|
476
|
+
) -> Callable[[spanner.DeleteSessionRequest], Awaitable[empty_pb2.Empty]]:
|
|
477
|
+
r"""Return a callable for the delete session method over gRPC.
|
|
478
|
+
|
|
479
|
+
Ends a session, releasing server resources associated
|
|
480
|
+
with it. This will asynchronously trigger cancellation
|
|
481
|
+
of any operations that are running with this session.
|
|
482
|
+
|
|
483
|
+
Returns:
|
|
484
|
+
Callable[[~.DeleteSessionRequest],
|
|
485
|
+
Awaitable[~.Empty]]:
|
|
486
|
+
A function that, when called, will call the underlying RPC
|
|
487
|
+
on the server.
|
|
488
|
+
"""
|
|
489
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
490
|
+
# the request.
|
|
491
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
492
|
+
# to pass in the functions for each.
|
|
493
|
+
if "delete_session" not in self._stubs:
|
|
494
|
+
self._stubs["delete_session"] = self._logged_channel.unary_unary(
|
|
495
|
+
"/google.spanner.v1.Spanner/DeleteSession",
|
|
496
|
+
request_serializer=spanner.DeleteSessionRequest.serialize,
|
|
497
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
498
|
+
)
|
|
499
|
+
return self._stubs["delete_session"]
|
|
500
|
+
|
|
501
|
+
@property
|
|
502
|
+
def execute_sql(
|
|
503
|
+
self,
|
|
504
|
+
) -> Callable[[spanner.ExecuteSqlRequest], Awaitable[result_set.ResultSet]]:
|
|
505
|
+
r"""Return a callable for the execute sql method over gRPC.
|
|
506
|
+
|
|
507
|
+
Executes an SQL statement, returning all results in a single
|
|
508
|
+
reply. This method cannot be used to return a result set larger
|
|
509
|
+
than 10 MiB; if the query yields more data than that, the query
|
|
510
|
+
fails with a ``FAILED_PRECONDITION`` error.
|
|
511
|
+
|
|
512
|
+
Operations inside read-write transactions might return
|
|
513
|
+
``ABORTED``. If this occurs, the application should restart the
|
|
514
|
+
transaction from the beginning. See
|
|
515
|
+
[Transaction][google.spanner.v1.Transaction] for more details.
|
|
516
|
+
|
|
517
|
+
Larger result sets can be fetched in streaming fashion by
|
|
518
|
+
calling
|
|
519
|
+
[ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
|
|
520
|
+
instead.
|
|
521
|
+
|
|
522
|
+
Returns:
|
|
523
|
+
Callable[[~.ExecuteSqlRequest],
|
|
524
|
+
Awaitable[~.ResultSet]]:
|
|
525
|
+
A function that, when called, will call the underlying RPC
|
|
526
|
+
on the server.
|
|
527
|
+
"""
|
|
528
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
529
|
+
# the request.
|
|
530
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
531
|
+
# to pass in the functions for each.
|
|
532
|
+
if "execute_sql" not in self._stubs:
|
|
533
|
+
self._stubs["execute_sql"] = self._logged_channel.unary_unary(
|
|
534
|
+
"/google.spanner.v1.Spanner/ExecuteSql",
|
|
535
|
+
request_serializer=spanner.ExecuteSqlRequest.serialize,
|
|
536
|
+
response_deserializer=result_set.ResultSet.deserialize,
|
|
537
|
+
)
|
|
538
|
+
return self._stubs["execute_sql"]
|
|
539
|
+
|
|
540
|
+
@property
|
|
541
|
+
def execute_streaming_sql(
|
|
542
|
+
self,
|
|
543
|
+
) -> Callable[[spanner.ExecuteSqlRequest], Awaitable[result_set.PartialResultSet]]:
|
|
544
|
+
r"""Return a callable for the execute streaming sql method over gRPC.
|
|
545
|
+
|
|
546
|
+
Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except
|
|
547
|
+
returns the result set as a stream. Unlike
|
|
548
|
+
[ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no
|
|
549
|
+
limit on the size of the returned result set. However, no
|
|
550
|
+
individual row in the result set can exceed 100 MiB, and no
|
|
551
|
+
column value can exceed 10 MiB.
|
|
552
|
+
|
|
553
|
+
Returns:
|
|
554
|
+
Callable[[~.ExecuteSqlRequest],
|
|
555
|
+
Awaitable[~.PartialResultSet]]:
|
|
556
|
+
A function that, when called, will call the underlying RPC
|
|
557
|
+
on the server.
|
|
558
|
+
"""
|
|
559
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
560
|
+
# the request.
|
|
561
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
562
|
+
# to pass in the functions for each.
|
|
563
|
+
if "execute_streaming_sql" not in self._stubs:
|
|
564
|
+
self._stubs["execute_streaming_sql"] = self._logged_channel.unary_stream(
|
|
565
|
+
"/google.spanner.v1.Spanner/ExecuteStreamingSql",
|
|
566
|
+
request_serializer=spanner.ExecuteSqlRequest.serialize,
|
|
567
|
+
response_deserializer=result_set.PartialResultSet.deserialize,
|
|
568
|
+
)
|
|
569
|
+
return self._stubs["execute_streaming_sql"]
|
|
570
|
+
|
|
571
|
+
@property
|
|
572
|
+
def execute_batch_dml(
|
|
573
|
+
self,
|
|
574
|
+
) -> Callable[
|
|
575
|
+
[spanner.ExecuteBatchDmlRequest], Awaitable[spanner.ExecuteBatchDmlResponse]
|
|
576
|
+
]:
|
|
577
|
+
r"""Return a callable for the execute batch dml method over gRPC.
|
|
578
|
+
|
|
579
|
+
Executes a batch of SQL DML statements. This method allows many
|
|
580
|
+
statements to be run with lower latency than submitting them
|
|
581
|
+
sequentially with
|
|
582
|
+
[ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
|
|
583
|
+
|
|
584
|
+
Statements are executed in sequential order. A request can
|
|
585
|
+
succeed even if a statement fails. The
|
|
586
|
+
[ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status]
|
|
587
|
+
field in the response provides information about the statement
|
|
588
|
+
that failed. Clients must inspect this field to determine
|
|
589
|
+
whether an error occurred.
|
|
590
|
+
|
|
591
|
+
Execution stops after the first failed statement; the remaining
|
|
592
|
+
statements are not executed.
|
|
593
|
+
|
|
594
|
+
Returns:
|
|
595
|
+
Callable[[~.ExecuteBatchDmlRequest],
|
|
596
|
+
Awaitable[~.ExecuteBatchDmlResponse]]:
|
|
597
|
+
A function that, when called, will call the underlying RPC
|
|
598
|
+
on the server.
|
|
599
|
+
"""
|
|
600
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
601
|
+
# the request.
|
|
602
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
603
|
+
# to pass in the functions for each.
|
|
604
|
+
if "execute_batch_dml" not in self._stubs:
|
|
605
|
+
self._stubs["execute_batch_dml"] = self._logged_channel.unary_unary(
|
|
606
|
+
"/google.spanner.v1.Spanner/ExecuteBatchDml",
|
|
607
|
+
request_serializer=spanner.ExecuteBatchDmlRequest.serialize,
|
|
608
|
+
response_deserializer=spanner.ExecuteBatchDmlResponse.deserialize,
|
|
609
|
+
)
|
|
610
|
+
return self._stubs["execute_batch_dml"]
|
|
611
|
+
|
|
612
|
+
@property
|
|
613
|
+
def read(self) -> Callable[[spanner.ReadRequest], Awaitable[result_set.ResultSet]]:
|
|
614
|
+
r"""Return a callable for the read method over gRPC.
|
|
615
|
+
|
|
616
|
+
Reads rows from the database using key lookups and scans, as a
|
|
617
|
+
simple key/value style alternative to
|
|
618
|
+
[ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method
|
|
619
|
+
cannot be used to return a result set larger than 10 MiB; if the
|
|
620
|
+
read matches more data than that, the read fails with a
|
|
621
|
+
``FAILED_PRECONDITION`` error.
|
|
622
|
+
|
|
623
|
+
Reads inside read-write transactions might return ``ABORTED``.
|
|
624
|
+
If this occurs, the application should restart the transaction
|
|
625
|
+
from the beginning. See
|
|
626
|
+
[Transaction][google.spanner.v1.Transaction] for more details.
|
|
627
|
+
|
|
628
|
+
Larger result sets can be yielded in streaming fashion by
|
|
629
|
+
calling [StreamingRead][google.spanner.v1.Spanner.StreamingRead]
|
|
630
|
+
instead.
|
|
631
|
+
|
|
632
|
+
Returns:
|
|
633
|
+
Callable[[~.ReadRequest],
|
|
634
|
+
Awaitable[~.ResultSet]]:
|
|
635
|
+
A function that, when called, will call the underlying RPC
|
|
636
|
+
on the server.
|
|
637
|
+
"""
|
|
638
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
639
|
+
# the request.
|
|
640
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
641
|
+
# to pass in the functions for each.
|
|
642
|
+
if "read" not in self._stubs:
|
|
643
|
+
self._stubs["read"] = self._logged_channel.unary_unary(
|
|
644
|
+
"/google.spanner.v1.Spanner/Read",
|
|
645
|
+
request_serializer=spanner.ReadRequest.serialize,
|
|
646
|
+
response_deserializer=result_set.ResultSet.deserialize,
|
|
647
|
+
)
|
|
648
|
+
return self._stubs["read"]
|
|
649
|
+
|
|
650
|
+
@property
|
|
651
|
+
def streaming_read(
|
|
652
|
+
self,
|
|
653
|
+
) -> Callable[[spanner.ReadRequest], Awaitable[result_set.PartialResultSet]]:
|
|
654
|
+
r"""Return a callable for the streaming read method over gRPC.
|
|
655
|
+
|
|
656
|
+
Like [Read][google.spanner.v1.Spanner.Read], except returns the
|
|
657
|
+
result set as a stream. Unlike
|
|
658
|
+
[Read][google.spanner.v1.Spanner.Read], there is no limit on the
|
|
659
|
+
size of the returned result set. However, no individual row in
|
|
660
|
+
the result set can exceed 100 MiB, and no column value can
|
|
661
|
+
exceed 10 MiB.
|
|
662
|
+
|
|
663
|
+
Returns:
|
|
664
|
+
Callable[[~.ReadRequest],
|
|
665
|
+
Awaitable[~.PartialResultSet]]:
|
|
666
|
+
A function that, when called, will call the underlying RPC
|
|
667
|
+
on the server.
|
|
668
|
+
"""
|
|
669
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
670
|
+
# the request.
|
|
671
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
672
|
+
# to pass in the functions for each.
|
|
673
|
+
if "streaming_read" not in self._stubs:
|
|
674
|
+
self._stubs["streaming_read"] = self._logged_channel.unary_stream(
|
|
675
|
+
"/google.spanner.v1.Spanner/StreamingRead",
|
|
676
|
+
request_serializer=spanner.ReadRequest.serialize,
|
|
677
|
+
response_deserializer=result_set.PartialResultSet.deserialize,
|
|
678
|
+
)
|
|
679
|
+
return self._stubs["streaming_read"]
|
|
680
|
+
|
|
681
|
+
@property
|
|
682
|
+
def begin_transaction(
|
|
683
|
+
self,
|
|
684
|
+
) -> Callable[
|
|
685
|
+
[spanner.BeginTransactionRequest], Awaitable[transaction.Transaction]
|
|
686
|
+
]:
|
|
687
|
+
r"""Return a callable for the begin transaction method over gRPC.
|
|
688
|
+
|
|
689
|
+
Begins a new transaction. This step can often be skipped:
|
|
690
|
+
[Read][google.spanner.v1.Spanner.Read],
|
|
691
|
+
[ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
|
|
692
|
+
[Commit][google.spanner.v1.Spanner.Commit] can begin a new
|
|
693
|
+
transaction as a side-effect.
|
|
694
|
+
|
|
695
|
+
Returns:
|
|
696
|
+
Callable[[~.BeginTransactionRequest],
|
|
697
|
+
Awaitable[~.Transaction]]:
|
|
698
|
+
A function that, when called, will call the underlying RPC
|
|
699
|
+
on the server.
|
|
700
|
+
"""
|
|
701
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
702
|
+
# the request.
|
|
703
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
704
|
+
# to pass in the functions for each.
|
|
705
|
+
if "begin_transaction" not in self._stubs:
|
|
706
|
+
self._stubs["begin_transaction"] = self._logged_channel.unary_unary(
|
|
707
|
+
"/google.spanner.v1.Spanner/BeginTransaction",
|
|
708
|
+
request_serializer=spanner.BeginTransactionRequest.serialize,
|
|
709
|
+
response_deserializer=transaction.Transaction.deserialize,
|
|
710
|
+
)
|
|
711
|
+
return self._stubs["begin_transaction"]
|
|
712
|
+
|
|
713
|
+
@property
|
|
714
|
+
def commit(
|
|
715
|
+
self,
|
|
716
|
+
) -> Callable[[spanner.CommitRequest], Awaitable[commit_response.CommitResponse]]:
|
|
717
|
+
r"""Return a callable for the commit method over gRPC.
|
|
718
|
+
|
|
719
|
+
Commits a transaction. The request includes the mutations to be
|
|
720
|
+
applied to rows in the database.
|
|
721
|
+
|
|
722
|
+
``Commit`` might return an ``ABORTED`` error. This can occur at
|
|
723
|
+
any time; commonly, the cause is conflicts with concurrent
|
|
724
|
+
transactions. However, it can also happen for a variety of other
|
|
725
|
+
reasons. If ``Commit`` returns ``ABORTED``, the caller should
|
|
726
|
+
re-attempt the transaction from the beginning, re-using the same
|
|
727
|
+
session.
|
|
728
|
+
|
|
729
|
+
On very rare occasions, ``Commit`` might return ``UNKNOWN``.
|
|
730
|
+
This can happen, for example, if the client job experiences a 1+
|
|
731
|
+
hour networking failure. At that point, Cloud Spanner has lost
|
|
732
|
+
track of the transaction outcome and we recommend that you
|
|
733
|
+
perform another read from the database to see the state of
|
|
734
|
+
things as they are now.
|
|
735
|
+
|
|
736
|
+
Returns:
|
|
737
|
+
Callable[[~.CommitRequest],
|
|
738
|
+
Awaitable[~.CommitResponse]]:
|
|
739
|
+
A function that, when called, will call the underlying RPC
|
|
740
|
+
on the server.
|
|
741
|
+
"""
|
|
742
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
743
|
+
# the request.
|
|
744
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
745
|
+
# to pass in the functions for each.
|
|
746
|
+
if "commit" not in self._stubs:
|
|
747
|
+
self._stubs["commit"] = self._logged_channel.unary_unary(
|
|
748
|
+
"/google.spanner.v1.Spanner/Commit",
|
|
749
|
+
request_serializer=spanner.CommitRequest.serialize,
|
|
750
|
+
response_deserializer=commit_response.CommitResponse.deserialize,
|
|
751
|
+
)
|
|
752
|
+
return self._stubs["commit"]
|
|
753
|
+
|
|
754
|
+
@property
|
|
755
|
+
def rollback(
|
|
756
|
+
self,
|
|
757
|
+
) -> Callable[[spanner.RollbackRequest], Awaitable[empty_pb2.Empty]]:
|
|
758
|
+
r"""Return a callable for the rollback method over gRPC.
|
|
759
|
+
|
|
760
|
+
Rolls back a transaction, releasing any locks it holds. It is a
|
|
761
|
+
good idea to call this for any transaction that includes one or
|
|
762
|
+
more [Read][google.spanner.v1.Spanner.Read] or
|
|
763
|
+
[ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and
|
|
764
|
+
ultimately decides not to commit.
|
|
765
|
+
|
|
766
|
+
``Rollback`` returns ``OK`` if it successfully aborts the
|
|
767
|
+
transaction, the transaction was already aborted, or the
|
|
768
|
+
transaction is not found. ``Rollback`` never returns
|
|
769
|
+
``ABORTED``.
|
|
770
|
+
|
|
771
|
+
Returns:
|
|
772
|
+
Callable[[~.RollbackRequest],
|
|
773
|
+
Awaitable[~.Empty]]:
|
|
774
|
+
A function that, when called, will call the underlying RPC
|
|
775
|
+
on the server.
|
|
776
|
+
"""
|
|
777
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
778
|
+
# the request.
|
|
779
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
780
|
+
# to pass in the functions for each.
|
|
781
|
+
if "rollback" not in self._stubs:
|
|
782
|
+
self._stubs["rollback"] = self._logged_channel.unary_unary(
|
|
783
|
+
"/google.spanner.v1.Spanner/Rollback",
|
|
784
|
+
request_serializer=spanner.RollbackRequest.serialize,
|
|
785
|
+
response_deserializer=empty_pb2.Empty.FromString,
|
|
786
|
+
)
|
|
787
|
+
return self._stubs["rollback"]
|
|
788
|
+
|
|
789
|
+
@property
|
|
790
|
+
def partition_query(
|
|
791
|
+
self,
|
|
792
|
+
) -> Callable[
|
|
793
|
+
[spanner.PartitionQueryRequest], Awaitable[spanner.PartitionResponse]
|
|
794
|
+
]:
|
|
795
|
+
r"""Return a callable for the partition query method over gRPC.
|
|
796
|
+
|
|
797
|
+
Creates a set of partition tokens that can be used to execute a
|
|
798
|
+
query operation in parallel. Each of the returned partition
|
|
799
|
+
tokens can be used by
|
|
800
|
+
[ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
|
|
801
|
+
to specify a subset of the query result to read. The same
|
|
802
|
+
session and read-only transaction must be used by the
|
|
803
|
+
PartitionQueryRequest used to create the partition tokens and
|
|
804
|
+
the ExecuteSqlRequests that use the partition tokens.
|
|
805
|
+
|
|
806
|
+
Partition tokens become invalid when the session used to create
|
|
807
|
+
them is deleted, is idle for too long, begins a new transaction,
|
|
808
|
+
or becomes too old. When any of these happen, it is not possible
|
|
809
|
+
to resume the query, and the whole operation must be restarted
|
|
810
|
+
from the beginning.
|
|
811
|
+
|
|
812
|
+
Returns:
|
|
813
|
+
Callable[[~.PartitionQueryRequest],
|
|
814
|
+
Awaitable[~.PartitionResponse]]:
|
|
815
|
+
A function that, when called, will call the underlying RPC
|
|
816
|
+
on the server.
|
|
817
|
+
"""
|
|
818
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
819
|
+
# the request.
|
|
820
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
821
|
+
# to pass in the functions for each.
|
|
822
|
+
if "partition_query" not in self._stubs:
|
|
823
|
+
self._stubs["partition_query"] = self._logged_channel.unary_unary(
|
|
824
|
+
"/google.spanner.v1.Spanner/PartitionQuery",
|
|
825
|
+
request_serializer=spanner.PartitionQueryRequest.serialize,
|
|
826
|
+
response_deserializer=spanner.PartitionResponse.deserialize,
|
|
827
|
+
)
|
|
828
|
+
return self._stubs["partition_query"]
|
|
829
|
+
|
|
830
|
+
@property
|
|
831
|
+
def partition_read(
|
|
832
|
+
self,
|
|
833
|
+
) -> Callable[[spanner.PartitionReadRequest], Awaitable[spanner.PartitionResponse]]:
|
|
834
|
+
r"""Return a callable for the partition read method over gRPC.
|
|
835
|
+
|
|
836
|
+
Creates a set of partition tokens that can be used to execute a
|
|
837
|
+
read operation in parallel. Each of the returned partition
|
|
838
|
+
tokens can be used by
|
|
839
|
+
[StreamingRead][google.spanner.v1.Spanner.StreamingRead] to
|
|
840
|
+
specify a subset of the read result to read. The same session
|
|
841
|
+
and read-only transaction must be used by the
|
|
842
|
+
PartitionReadRequest used to create the partition tokens and the
|
|
843
|
+
ReadRequests that use the partition tokens. There are no
|
|
844
|
+
ordering guarantees on rows returned among the returned
|
|
845
|
+
partition tokens, or even within each individual StreamingRead
|
|
846
|
+
call issued with a partition_token.
|
|
847
|
+
|
|
848
|
+
Partition tokens become invalid when the session used to create
|
|
849
|
+
them is deleted, is idle for too long, begins a new transaction,
|
|
850
|
+
or becomes too old. When any of these happen, it is not possible
|
|
851
|
+
to resume the read, and the whole operation must be restarted
|
|
852
|
+
from the beginning.
|
|
853
|
+
|
|
854
|
+
Returns:
|
|
855
|
+
Callable[[~.PartitionReadRequest],
|
|
856
|
+
Awaitable[~.PartitionResponse]]:
|
|
857
|
+
A function that, when called, will call the underlying RPC
|
|
858
|
+
on the server.
|
|
859
|
+
"""
|
|
860
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
861
|
+
# the request.
|
|
862
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
863
|
+
# to pass in the functions for each.
|
|
864
|
+
if "partition_read" not in self._stubs:
|
|
865
|
+
self._stubs["partition_read"] = self._logged_channel.unary_unary(
|
|
866
|
+
"/google.spanner.v1.Spanner/PartitionRead",
|
|
867
|
+
request_serializer=spanner.PartitionReadRequest.serialize,
|
|
868
|
+
response_deserializer=spanner.PartitionResponse.deserialize,
|
|
869
|
+
)
|
|
870
|
+
return self._stubs["partition_read"]
|
|
871
|
+
|
|
872
|
+
@property
|
|
873
|
+
def batch_write(
|
|
874
|
+
self,
|
|
875
|
+
) -> Callable[[spanner.BatchWriteRequest], Awaitable[spanner.BatchWriteResponse]]:
|
|
876
|
+
r"""Return a callable for the batch write method over gRPC.
|
|
877
|
+
|
|
878
|
+
Batches the supplied mutation groups in a collection
|
|
879
|
+
of efficient transactions. All mutations in a group are
|
|
880
|
+
committed atomically. However, mutations across groups
|
|
881
|
+
can be committed non-atomically in an unspecified order
|
|
882
|
+
and thus, they must be independent of each other.
|
|
883
|
+
Partial failure is possible, i.e., some groups may have
|
|
884
|
+
been committed successfully, while some may have failed.
|
|
885
|
+
The results of individual batches are streamed into the
|
|
886
|
+
response as the batches are applied.
|
|
887
|
+
|
|
888
|
+
BatchWrite requests are not replay protected, meaning
|
|
889
|
+
that each mutation group may be applied more than once.
|
|
890
|
+
Replays of non-idempotent mutations may have undesirable
|
|
891
|
+
effects. For example, replays of an insert mutation may
|
|
892
|
+
produce an already exists error or if you use generated
|
|
893
|
+
or commit timestamp-based keys, it may result in
|
|
894
|
+
additional rows being added to the mutation's table. We
|
|
895
|
+
recommend structuring your mutation groups to be
|
|
896
|
+
idempotent to avoid this issue.
|
|
897
|
+
|
|
898
|
+
Returns:
|
|
899
|
+
Callable[[~.BatchWriteRequest],
|
|
900
|
+
Awaitable[~.BatchWriteResponse]]:
|
|
901
|
+
A function that, when called, will call the underlying RPC
|
|
902
|
+
on the server.
|
|
903
|
+
"""
|
|
904
|
+
# Generate a "stub function" on-the-fly which will actually make
|
|
905
|
+
# the request.
|
|
906
|
+
# gRPC handles serialization and deserialization, so we just need
|
|
907
|
+
# to pass in the functions for each.
|
|
908
|
+
if "batch_write" not in self._stubs:
|
|
909
|
+
self._stubs["batch_write"] = self._logged_channel.unary_stream(
|
|
910
|
+
"/google.spanner.v1.Spanner/BatchWrite",
|
|
911
|
+
request_serializer=spanner.BatchWriteRequest.serialize,
|
|
912
|
+
response_deserializer=spanner.BatchWriteResponse.deserialize,
|
|
913
|
+
)
|
|
914
|
+
return self._stubs["batch_write"]
|
|
915
|
+
|
|
916
|
+
def _prep_wrapped_messages(self, client_info):
|
|
917
|
+
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
|
|
918
|
+
self._wrapped_methods = {
|
|
919
|
+
self.create_session: self._wrap_method(
|
|
920
|
+
self.create_session,
|
|
921
|
+
default_retry=retries.AsyncRetry(
|
|
922
|
+
initial=0.25,
|
|
923
|
+
maximum=32.0,
|
|
924
|
+
multiplier=1.3,
|
|
925
|
+
predicate=retries.if_exception_type(
|
|
926
|
+
core_exceptions.ResourceExhausted,
|
|
927
|
+
core_exceptions.ServiceUnavailable,
|
|
928
|
+
),
|
|
929
|
+
deadline=30.0,
|
|
930
|
+
),
|
|
931
|
+
default_timeout=30.0,
|
|
932
|
+
client_info=client_info,
|
|
933
|
+
),
|
|
934
|
+
self.batch_create_sessions: self._wrap_method(
|
|
935
|
+
self.batch_create_sessions,
|
|
936
|
+
default_retry=retries.AsyncRetry(
|
|
937
|
+
initial=0.25,
|
|
938
|
+
maximum=32.0,
|
|
939
|
+
multiplier=1.3,
|
|
940
|
+
predicate=retries.if_exception_type(
|
|
941
|
+
core_exceptions.ResourceExhausted,
|
|
942
|
+
core_exceptions.ServiceUnavailable,
|
|
943
|
+
),
|
|
944
|
+
deadline=60.0,
|
|
945
|
+
),
|
|
946
|
+
default_timeout=60.0,
|
|
947
|
+
client_info=client_info,
|
|
948
|
+
),
|
|
949
|
+
self.get_session: self._wrap_method(
|
|
950
|
+
self.get_session,
|
|
951
|
+
default_retry=retries.AsyncRetry(
|
|
952
|
+
initial=0.25,
|
|
953
|
+
maximum=32.0,
|
|
954
|
+
multiplier=1.3,
|
|
955
|
+
predicate=retries.if_exception_type(
|
|
956
|
+
core_exceptions.ResourceExhausted,
|
|
957
|
+
core_exceptions.ServiceUnavailable,
|
|
958
|
+
),
|
|
959
|
+
deadline=30.0,
|
|
960
|
+
),
|
|
961
|
+
default_timeout=30.0,
|
|
962
|
+
client_info=client_info,
|
|
963
|
+
),
|
|
964
|
+
self.list_sessions: self._wrap_method(
|
|
965
|
+
self.list_sessions,
|
|
966
|
+
default_retry=retries.AsyncRetry(
|
|
967
|
+
initial=0.25,
|
|
968
|
+
maximum=32.0,
|
|
969
|
+
multiplier=1.3,
|
|
970
|
+
predicate=retries.if_exception_type(
|
|
971
|
+
core_exceptions.ResourceExhausted,
|
|
972
|
+
core_exceptions.ServiceUnavailable,
|
|
973
|
+
),
|
|
974
|
+
deadline=3600.0,
|
|
975
|
+
),
|
|
976
|
+
default_timeout=3600.0,
|
|
977
|
+
client_info=client_info,
|
|
978
|
+
),
|
|
979
|
+
self.delete_session: self._wrap_method(
|
|
980
|
+
self.delete_session,
|
|
981
|
+
default_retry=retries.AsyncRetry(
|
|
982
|
+
initial=0.25,
|
|
983
|
+
maximum=32.0,
|
|
984
|
+
multiplier=1.3,
|
|
985
|
+
predicate=retries.if_exception_type(
|
|
986
|
+
core_exceptions.ResourceExhausted,
|
|
987
|
+
core_exceptions.ServiceUnavailable,
|
|
988
|
+
),
|
|
989
|
+
deadline=30.0,
|
|
990
|
+
),
|
|
991
|
+
default_timeout=30.0,
|
|
992
|
+
client_info=client_info,
|
|
993
|
+
),
|
|
994
|
+
self.execute_sql: self._wrap_method(
|
|
995
|
+
self.execute_sql,
|
|
996
|
+
default_retry=retries.AsyncRetry(
|
|
997
|
+
initial=0.25,
|
|
998
|
+
maximum=32.0,
|
|
999
|
+
multiplier=1.3,
|
|
1000
|
+
predicate=retries.if_exception_type(
|
|
1001
|
+
core_exceptions.ResourceExhausted,
|
|
1002
|
+
core_exceptions.ServiceUnavailable,
|
|
1003
|
+
),
|
|
1004
|
+
deadline=30.0,
|
|
1005
|
+
),
|
|
1006
|
+
default_timeout=30.0,
|
|
1007
|
+
client_info=client_info,
|
|
1008
|
+
),
|
|
1009
|
+
self.execute_streaming_sql: self._wrap_method(
|
|
1010
|
+
self.execute_streaming_sql,
|
|
1011
|
+
default_timeout=3600.0,
|
|
1012
|
+
client_info=client_info,
|
|
1013
|
+
),
|
|
1014
|
+
self.execute_batch_dml: self._wrap_method(
|
|
1015
|
+
self.execute_batch_dml,
|
|
1016
|
+
default_retry=retries.AsyncRetry(
|
|
1017
|
+
initial=0.25,
|
|
1018
|
+
maximum=32.0,
|
|
1019
|
+
multiplier=1.3,
|
|
1020
|
+
predicate=retries.if_exception_type(
|
|
1021
|
+
core_exceptions.ResourceExhausted,
|
|
1022
|
+
core_exceptions.ServiceUnavailable,
|
|
1023
|
+
),
|
|
1024
|
+
deadline=30.0,
|
|
1025
|
+
),
|
|
1026
|
+
default_timeout=30.0,
|
|
1027
|
+
client_info=client_info,
|
|
1028
|
+
),
|
|
1029
|
+
self.read: self._wrap_method(
|
|
1030
|
+
self.read,
|
|
1031
|
+
default_retry=retries.AsyncRetry(
|
|
1032
|
+
initial=0.25,
|
|
1033
|
+
maximum=32.0,
|
|
1034
|
+
multiplier=1.3,
|
|
1035
|
+
predicate=retries.if_exception_type(
|
|
1036
|
+
core_exceptions.ResourceExhausted,
|
|
1037
|
+
core_exceptions.ServiceUnavailable,
|
|
1038
|
+
),
|
|
1039
|
+
deadline=30.0,
|
|
1040
|
+
),
|
|
1041
|
+
default_timeout=30.0,
|
|
1042
|
+
client_info=client_info,
|
|
1043
|
+
),
|
|
1044
|
+
self.streaming_read: self._wrap_method(
|
|
1045
|
+
self.streaming_read,
|
|
1046
|
+
default_timeout=3600.0,
|
|
1047
|
+
client_info=client_info,
|
|
1048
|
+
),
|
|
1049
|
+
self.begin_transaction: self._wrap_method(
|
|
1050
|
+
self.begin_transaction,
|
|
1051
|
+
default_retry=retries.AsyncRetry(
|
|
1052
|
+
initial=0.25,
|
|
1053
|
+
maximum=32.0,
|
|
1054
|
+
multiplier=1.3,
|
|
1055
|
+
predicate=retries.if_exception_type(
|
|
1056
|
+
core_exceptions.ResourceExhausted,
|
|
1057
|
+
core_exceptions.ServiceUnavailable,
|
|
1058
|
+
),
|
|
1059
|
+
deadline=30.0,
|
|
1060
|
+
),
|
|
1061
|
+
default_timeout=30.0,
|
|
1062
|
+
client_info=client_info,
|
|
1063
|
+
),
|
|
1064
|
+
self.commit: self._wrap_method(
|
|
1065
|
+
self.commit,
|
|
1066
|
+
default_retry=retries.AsyncRetry(
|
|
1067
|
+
initial=0.25,
|
|
1068
|
+
maximum=32.0,
|
|
1069
|
+
multiplier=1.3,
|
|
1070
|
+
predicate=retries.if_exception_type(
|
|
1071
|
+
core_exceptions.ResourceExhausted,
|
|
1072
|
+
core_exceptions.ServiceUnavailable,
|
|
1073
|
+
),
|
|
1074
|
+
deadline=3600.0,
|
|
1075
|
+
),
|
|
1076
|
+
default_timeout=3600.0,
|
|
1077
|
+
client_info=client_info,
|
|
1078
|
+
),
|
|
1079
|
+
self.rollback: self._wrap_method(
|
|
1080
|
+
self.rollback,
|
|
1081
|
+
default_retry=retries.AsyncRetry(
|
|
1082
|
+
initial=0.25,
|
|
1083
|
+
maximum=32.0,
|
|
1084
|
+
multiplier=1.3,
|
|
1085
|
+
predicate=retries.if_exception_type(
|
|
1086
|
+
core_exceptions.ResourceExhausted,
|
|
1087
|
+
core_exceptions.ServiceUnavailable,
|
|
1088
|
+
),
|
|
1089
|
+
deadline=30.0,
|
|
1090
|
+
),
|
|
1091
|
+
default_timeout=30.0,
|
|
1092
|
+
client_info=client_info,
|
|
1093
|
+
),
|
|
1094
|
+
self.partition_query: self._wrap_method(
|
|
1095
|
+
self.partition_query,
|
|
1096
|
+
default_retry=retries.AsyncRetry(
|
|
1097
|
+
initial=0.25,
|
|
1098
|
+
maximum=32.0,
|
|
1099
|
+
multiplier=1.3,
|
|
1100
|
+
predicate=retries.if_exception_type(
|
|
1101
|
+
core_exceptions.ResourceExhausted,
|
|
1102
|
+
core_exceptions.ServiceUnavailable,
|
|
1103
|
+
),
|
|
1104
|
+
deadline=30.0,
|
|
1105
|
+
),
|
|
1106
|
+
default_timeout=30.0,
|
|
1107
|
+
client_info=client_info,
|
|
1108
|
+
),
|
|
1109
|
+
self.partition_read: self._wrap_method(
|
|
1110
|
+
self.partition_read,
|
|
1111
|
+
default_retry=retries.AsyncRetry(
|
|
1112
|
+
initial=0.25,
|
|
1113
|
+
maximum=32.0,
|
|
1114
|
+
multiplier=1.3,
|
|
1115
|
+
predicate=retries.if_exception_type(
|
|
1116
|
+
core_exceptions.ResourceExhausted,
|
|
1117
|
+
core_exceptions.ServiceUnavailable,
|
|
1118
|
+
),
|
|
1119
|
+
deadline=30.0,
|
|
1120
|
+
),
|
|
1121
|
+
default_timeout=30.0,
|
|
1122
|
+
client_info=client_info,
|
|
1123
|
+
),
|
|
1124
|
+
self.batch_write: self._wrap_method(
|
|
1125
|
+
self.batch_write,
|
|
1126
|
+
default_timeout=3600.0,
|
|
1127
|
+
client_info=client_info,
|
|
1128
|
+
),
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
def _wrap_method(self, func, *args, **kwargs):
|
|
1132
|
+
if self._wrap_with_kind: # pragma: NO COVER
|
|
1133
|
+
kwargs["kind"] = self.kind
|
|
1134
|
+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
|
|
1135
|
+
|
|
1136
|
+
def close(self):
|
|
1137
|
+
return self._logged_channel.close()
|
|
1138
|
+
|
|
1139
|
+
@property
|
|
1140
|
+
def kind(self) -> str:
|
|
1141
|
+
return "grpc_asyncio"
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
__all__ = ("SpannerGrpcAsyncIOTransport",)
|