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,1815 @@
|
|
|
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
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from typing import MutableMapping, MutableSequence
|
|
19
|
+
|
|
20
|
+
import proto # type: ignore
|
|
21
|
+
|
|
22
|
+
from google.cloud.spanner_v1.types import keys
|
|
23
|
+
from google.cloud.spanner_v1.types import mutation
|
|
24
|
+
from google.cloud.spanner_v1.types import result_set
|
|
25
|
+
from google.cloud.spanner_v1.types import transaction as gs_transaction
|
|
26
|
+
from google.cloud.spanner_v1.types import type as gs_type
|
|
27
|
+
from google.protobuf import duration_pb2 # type: ignore
|
|
28
|
+
from google.protobuf import struct_pb2 # type: ignore
|
|
29
|
+
from google.protobuf import timestamp_pb2 # type: ignore
|
|
30
|
+
from google.rpc import status_pb2 # type: ignore
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
__protobuf__ = proto.module(
|
|
34
|
+
package="google.spanner.v1",
|
|
35
|
+
manifest={
|
|
36
|
+
"CreateSessionRequest",
|
|
37
|
+
"BatchCreateSessionsRequest",
|
|
38
|
+
"BatchCreateSessionsResponse",
|
|
39
|
+
"Session",
|
|
40
|
+
"GetSessionRequest",
|
|
41
|
+
"ListSessionsRequest",
|
|
42
|
+
"ListSessionsResponse",
|
|
43
|
+
"DeleteSessionRequest",
|
|
44
|
+
"RequestOptions",
|
|
45
|
+
"DirectedReadOptions",
|
|
46
|
+
"ExecuteSqlRequest",
|
|
47
|
+
"ExecuteBatchDmlRequest",
|
|
48
|
+
"ExecuteBatchDmlResponse",
|
|
49
|
+
"PartitionOptions",
|
|
50
|
+
"PartitionQueryRequest",
|
|
51
|
+
"PartitionReadRequest",
|
|
52
|
+
"Partition",
|
|
53
|
+
"PartitionResponse",
|
|
54
|
+
"ReadRequest",
|
|
55
|
+
"BeginTransactionRequest",
|
|
56
|
+
"CommitRequest",
|
|
57
|
+
"RollbackRequest",
|
|
58
|
+
"BatchWriteRequest",
|
|
59
|
+
"BatchWriteResponse",
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CreateSessionRequest(proto.Message):
|
|
65
|
+
r"""The request for
|
|
66
|
+
[CreateSession][google.spanner.v1.Spanner.CreateSession].
|
|
67
|
+
|
|
68
|
+
Attributes:
|
|
69
|
+
database (str):
|
|
70
|
+
Required. The database in which the new
|
|
71
|
+
session is created.
|
|
72
|
+
session (google.cloud.spanner_v1.types.Session):
|
|
73
|
+
Required. The session to create.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
database: str = proto.Field(
|
|
77
|
+
proto.STRING,
|
|
78
|
+
number=1,
|
|
79
|
+
)
|
|
80
|
+
session: "Session" = proto.Field(
|
|
81
|
+
proto.MESSAGE,
|
|
82
|
+
number=2,
|
|
83
|
+
message="Session",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class BatchCreateSessionsRequest(proto.Message):
|
|
88
|
+
r"""The request for
|
|
89
|
+
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
|
|
90
|
+
|
|
91
|
+
Attributes:
|
|
92
|
+
database (str):
|
|
93
|
+
Required. The database in which the new
|
|
94
|
+
sessions are created.
|
|
95
|
+
session_template (google.cloud.spanner_v1.types.Session):
|
|
96
|
+
Parameters to be applied to each created
|
|
97
|
+
session.
|
|
98
|
+
session_count (int):
|
|
99
|
+
Required. The number of sessions to be created in this batch
|
|
100
|
+
call. The API may return fewer than the requested number of
|
|
101
|
+
sessions. If a specific number of sessions are desired, the
|
|
102
|
+
client can make additional calls to BatchCreateSessions
|
|
103
|
+
(adjusting
|
|
104
|
+
[session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
|
|
105
|
+
as necessary).
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
database: str = proto.Field(
|
|
109
|
+
proto.STRING,
|
|
110
|
+
number=1,
|
|
111
|
+
)
|
|
112
|
+
session_template: "Session" = proto.Field(
|
|
113
|
+
proto.MESSAGE,
|
|
114
|
+
number=2,
|
|
115
|
+
message="Session",
|
|
116
|
+
)
|
|
117
|
+
session_count: int = proto.Field(
|
|
118
|
+
proto.INT32,
|
|
119
|
+
number=3,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class BatchCreateSessionsResponse(proto.Message):
|
|
124
|
+
r"""The response for
|
|
125
|
+
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
|
|
126
|
+
|
|
127
|
+
Attributes:
|
|
128
|
+
session (MutableSequence[google.cloud.spanner_v1.types.Session]):
|
|
129
|
+
The freshly created sessions.
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
session: MutableSequence["Session"] = proto.RepeatedField(
|
|
133
|
+
proto.MESSAGE,
|
|
134
|
+
number=1,
|
|
135
|
+
message="Session",
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class Session(proto.Message):
|
|
140
|
+
r"""A session in the Cloud Spanner API.
|
|
141
|
+
|
|
142
|
+
Attributes:
|
|
143
|
+
name (str):
|
|
144
|
+
Output only. The name of the session. This is
|
|
145
|
+
always system-assigned.
|
|
146
|
+
labels (MutableMapping[str, str]):
|
|
147
|
+
The labels for the session.
|
|
148
|
+
|
|
149
|
+
- Label keys must be between 1 and 63 characters long and
|
|
150
|
+
must conform to the following regular expression:
|
|
151
|
+
``[a-z]([-a-z0-9]*[a-z0-9])?``.
|
|
152
|
+
- Label values must be between 0 and 63 characters long and
|
|
153
|
+
must conform to the regular expression
|
|
154
|
+
``([a-z]([-a-z0-9]*[a-z0-9])?)?``.
|
|
155
|
+
- No more than 64 labels can be associated with a given
|
|
156
|
+
session.
|
|
157
|
+
|
|
158
|
+
See https://goo.gl/xmQnxf for more information on and
|
|
159
|
+
examples of labels.
|
|
160
|
+
create_time (google.protobuf.timestamp_pb2.Timestamp):
|
|
161
|
+
Output only. The timestamp when the session
|
|
162
|
+
is created.
|
|
163
|
+
approximate_last_use_time (google.protobuf.timestamp_pb2.Timestamp):
|
|
164
|
+
Output only. The approximate timestamp when
|
|
165
|
+
the session is last used. It is typically
|
|
166
|
+
earlier than the actual last use time.
|
|
167
|
+
creator_role (str):
|
|
168
|
+
The database role which created this session.
|
|
169
|
+
multiplexed (bool):
|
|
170
|
+
Optional. If true, specifies a multiplexed session. A
|
|
171
|
+
multiplexed session may be used for multiple, concurrent
|
|
172
|
+
read-only operations but can not be used for read-write
|
|
173
|
+
transactions, partitioned reads, or partitioned queries.
|
|
174
|
+
Multiplexed sessions can be created via
|
|
175
|
+
[CreateSession][google.spanner.v1.Spanner.CreateSession] but
|
|
176
|
+
not via
|
|
177
|
+
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
|
|
178
|
+
Multiplexed sessions may not be deleted nor listed.
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
name: str = proto.Field(
|
|
182
|
+
proto.STRING,
|
|
183
|
+
number=1,
|
|
184
|
+
)
|
|
185
|
+
labels: MutableMapping[str, str] = proto.MapField(
|
|
186
|
+
proto.STRING,
|
|
187
|
+
proto.STRING,
|
|
188
|
+
number=2,
|
|
189
|
+
)
|
|
190
|
+
create_time: timestamp_pb2.Timestamp = proto.Field(
|
|
191
|
+
proto.MESSAGE,
|
|
192
|
+
number=3,
|
|
193
|
+
message=timestamp_pb2.Timestamp,
|
|
194
|
+
)
|
|
195
|
+
approximate_last_use_time: timestamp_pb2.Timestamp = proto.Field(
|
|
196
|
+
proto.MESSAGE,
|
|
197
|
+
number=4,
|
|
198
|
+
message=timestamp_pb2.Timestamp,
|
|
199
|
+
)
|
|
200
|
+
creator_role: str = proto.Field(
|
|
201
|
+
proto.STRING,
|
|
202
|
+
number=5,
|
|
203
|
+
)
|
|
204
|
+
multiplexed: bool = proto.Field(
|
|
205
|
+
proto.BOOL,
|
|
206
|
+
number=6,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class GetSessionRequest(proto.Message):
|
|
211
|
+
r"""The request for [GetSession][google.spanner.v1.Spanner.GetSession].
|
|
212
|
+
|
|
213
|
+
Attributes:
|
|
214
|
+
name (str):
|
|
215
|
+
Required. The name of the session to
|
|
216
|
+
retrieve.
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
name: str = proto.Field(
|
|
220
|
+
proto.STRING,
|
|
221
|
+
number=1,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class ListSessionsRequest(proto.Message):
|
|
226
|
+
r"""The request for
|
|
227
|
+
[ListSessions][google.spanner.v1.Spanner.ListSessions].
|
|
228
|
+
|
|
229
|
+
Attributes:
|
|
230
|
+
database (str):
|
|
231
|
+
Required. The database in which to list
|
|
232
|
+
sessions.
|
|
233
|
+
page_size (int):
|
|
234
|
+
Number of sessions to be returned in the
|
|
235
|
+
response. If 0 or less, defaults to the server's
|
|
236
|
+
maximum allowed page size.
|
|
237
|
+
page_token (str):
|
|
238
|
+
If non-empty, ``page_token`` should contain a
|
|
239
|
+
[next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token]
|
|
240
|
+
from a previous
|
|
241
|
+
[ListSessionsResponse][google.spanner.v1.ListSessionsResponse].
|
|
242
|
+
filter (str):
|
|
243
|
+
An expression for filtering the results of the request.
|
|
244
|
+
Filter rules are case insensitive. The fields eligible for
|
|
245
|
+
filtering are:
|
|
246
|
+
|
|
247
|
+
- ``labels.key`` where key is the name of a label
|
|
248
|
+
|
|
249
|
+
Some examples of using filters are:
|
|
250
|
+
|
|
251
|
+
- ``labels.env:*`` --> The session has the label "env".
|
|
252
|
+
- ``labels.env:dev`` --> The session has the label "env"
|
|
253
|
+
and the value of the label contains the string "dev".
|
|
254
|
+
"""
|
|
255
|
+
|
|
256
|
+
database: str = proto.Field(
|
|
257
|
+
proto.STRING,
|
|
258
|
+
number=1,
|
|
259
|
+
)
|
|
260
|
+
page_size: int = proto.Field(
|
|
261
|
+
proto.INT32,
|
|
262
|
+
number=2,
|
|
263
|
+
)
|
|
264
|
+
page_token: str = proto.Field(
|
|
265
|
+
proto.STRING,
|
|
266
|
+
number=3,
|
|
267
|
+
)
|
|
268
|
+
filter: str = proto.Field(
|
|
269
|
+
proto.STRING,
|
|
270
|
+
number=4,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class ListSessionsResponse(proto.Message):
|
|
275
|
+
r"""The response for
|
|
276
|
+
[ListSessions][google.spanner.v1.Spanner.ListSessions].
|
|
277
|
+
|
|
278
|
+
Attributes:
|
|
279
|
+
sessions (MutableSequence[google.cloud.spanner_v1.types.Session]):
|
|
280
|
+
The list of requested sessions.
|
|
281
|
+
next_page_token (str):
|
|
282
|
+
``next_page_token`` can be sent in a subsequent
|
|
283
|
+
[ListSessions][google.spanner.v1.Spanner.ListSessions] call
|
|
284
|
+
to fetch more of the matching sessions.
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
@property
|
|
288
|
+
def raw_page(self):
|
|
289
|
+
return self
|
|
290
|
+
|
|
291
|
+
sessions: MutableSequence["Session"] = proto.RepeatedField(
|
|
292
|
+
proto.MESSAGE,
|
|
293
|
+
number=1,
|
|
294
|
+
message="Session",
|
|
295
|
+
)
|
|
296
|
+
next_page_token: str = proto.Field(
|
|
297
|
+
proto.STRING,
|
|
298
|
+
number=2,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
class DeleteSessionRequest(proto.Message):
|
|
303
|
+
r"""The request for
|
|
304
|
+
[DeleteSession][google.spanner.v1.Spanner.DeleteSession].
|
|
305
|
+
|
|
306
|
+
Attributes:
|
|
307
|
+
name (str):
|
|
308
|
+
Required. The name of the session to delete.
|
|
309
|
+
"""
|
|
310
|
+
|
|
311
|
+
name: str = proto.Field(
|
|
312
|
+
proto.STRING,
|
|
313
|
+
number=1,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
class RequestOptions(proto.Message):
|
|
318
|
+
r"""Common request options for various APIs.
|
|
319
|
+
|
|
320
|
+
Attributes:
|
|
321
|
+
priority (google.cloud.spanner_v1.types.RequestOptions.Priority):
|
|
322
|
+
Priority for the request.
|
|
323
|
+
request_tag (str):
|
|
324
|
+
A per-request tag which can be applied to queries or reads,
|
|
325
|
+
used for statistics collection. Both request_tag and
|
|
326
|
+
transaction_tag can be specified for a read or query that
|
|
327
|
+
belongs to a transaction. This field is ignored for requests
|
|
328
|
+
where it's not applicable (e.g. CommitRequest). Legal
|
|
329
|
+
characters for ``request_tag`` values are all printable
|
|
330
|
+
characters (ASCII 32 - 126) and the length of a request_tag
|
|
331
|
+
is limited to 50 characters. Values that exceed this limit
|
|
332
|
+
are truncated. Any leading underscore (_) characters will be
|
|
333
|
+
removed from the string.
|
|
334
|
+
transaction_tag (str):
|
|
335
|
+
A tag used for statistics collection about this transaction.
|
|
336
|
+
Both request_tag and transaction_tag can be specified for a
|
|
337
|
+
read or query that belongs to a transaction. The value of
|
|
338
|
+
transaction_tag should be the same for all requests
|
|
339
|
+
belonging to the same transaction. If this request doesn't
|
|
340
|
+
belong to any transaction, transaction_tag will be ignored.
|
|
341
|
+
Legal characters for ``transaction_tag`` values are all
|
|
342
|
+
printable characters (ASCII 32 - 126) and the length of a
|
|
343
|
+
transaction_tag is limited to 50 characters. Values that
|
|
344
|
+
exceed this limit are truncated. Any leading underscore (_)
|
|
345
|
+
characters will be removed from the string.
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
class Priority(proto.Enum):
|
|
349
|
+
r"""The relative priority for requests. Note that priority is not
|
|
350
|
+
applicable for
|
|
351
|
+
[BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
|
|
352
|
+
|
|
353
|
+
The priority acts as a hint to the Cloud Spanner scheduler and does
|
|
354
|
+
not guarantee priority or order of execution. For example:
|
|
355
|
+
|
|
356
|
+
- Some parts of a write operation always execute at
|
|
357
|
+
``PRIORITY_HIGH``, regardless of the specified priority. This may
|
|
358
|
+
cause you to see an increase in high priority workload even when
|
|
359
|
+
executing a low priority request. This can also potentially cause
|
|
360
|
+
a priority inversion where a lower priority request will be
|
|
361
|
+
fulfilled ahead of a higher priority request.
|
|
362
|
+
- If a transaction contains multiple operations with different
|
|
363
|
+
priorities, Cloud Spanner does not guarantee to process the
|
|
364
|
+
higher priority operations first. There may be other constraints
|
|
365
|
+
to satisfy, such as order of operations.
|
|
366
|
+
|
|
367
|
+
Values:
|
|
368
|
+
PRIORITY_UNSPECIFIED (0):
|
|
369
|
+
``PRIORITY_UNSPECIFIED`` is equivalent to ``PRIORITY_HIGH``.
|
|
370
|
+
PRIORITY_LOW (1):
|
|
371
|
+
This specifies that the request is low
|
|
372
|
+
priority.
|
|
373
|
+
PRIORITY_MEDIUM (2):
|
|
374
|
+
This specifies that the request is medium
|
|
375
|
+
priority.
|
|
376
|
+
PRIORITY_HIGH (3):
|
|
377
|
+
This specifies that the request is high
|
|
378
|
+
priority.
|
|
379
|
+
"""
|
|
380
|
+
PRIORITY_UNSPECIFIED = 0
|
|
381
|
+
PRIORITY_LOW = 1
|
|
382
|
+
PRIORITY_MEDIUM = 2
|
|
383
|
+
PRIORITY_HIGH = 3
|
|
384
|
+
|
|
385
|
+
priority: Priority = proto.Field(
|
|
386
|
+
proto.ENUM,
|
|
387
|
+
number=1,
|
|
388
|
+
enum=Priority,
|
|
389
|
+
)
|
|
390
|
+
request_tag: str = proto.Field(
|
|
391
|
+
proto.STRING,
|
|
392
|
+
number=2,
|
|
393
|
+
)
|
|
394
|
+
transaction_tag: str = proto.Field(
|
|
395
|
+
proto.STRING,
|
|
396
|
+
number=3,
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
class DirectedReadOptions(proto.Message):
|
|
401
|
+
r"""The DirectedReadOptions can be used to indicate which replicas or
|
|
402
|
+
regions should be used for non-transactional reads or queries.
|
|
403
|
+
|
|
404
|
+
DirectedReadOptions may only be specified for a read-only
|
|
405
|
+
transaction, otherwise the API will return an ``INVALID_ARGUMENT``
|
|
406
|
+
error.
|
|
407
|
+
|
|
408
|
+
This message has `oneof`_ fields (mutually exclusive fields).
|
|
409
|
+
For each oneof, at most one member field can be set at the same time.
|
|
410
|
+
Setting any member of the oneof automatically clears all other
|
|
411
|
+
members.
|
|
412
|
+
|
|
413
|
+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
|
|
414
|
+
|
|
415
|
+
Attributes:
|
|
416
|
+
include_replicas (google.cloud.spanner_v1.types.DirectedReadOptions.IncludeReplicas):
|
|
417
|
+
Include_replicas indicates the order of replicas (as they
|
|
418
|
+
appear in this list) to process the request. If
|
|
419
|
+
auto_failover_disabled is set to true and all replicas are
|
|
420
|
+
exhausted without finding a healthy replica, Spanner will
|
|
421
|
+
wait for a replica in the list to become available, requests
|
|
422
|
+
may fail due to ``DEADLINE_EXCEEDED`` errors.
|
|
423
|
+
|
|
424
|
+
This field is a member of `oneof`_ ``replicas``.
|
|
425
|
+
exclude_replicas (google.cloud.spanner_v1.types.DirectedReadOptions.ExcludeReplicas):
|
|
426
|
+
Exclude_replicas indicates that specified replicas should be
|
|
427
|
+
excluded from serving requests. Spanner will not route
|
|
428
|
+
requests to the replicas in this list.
|
|
429
|
+
|
|
430
|
+
This field is a member of `oneof`_ ``replicas``.
|
|
431
|
+
"""
|
|
432
|
+
|
|
433
|
+
class ReplicaSelection(proto.Message):
|
|
434
|
+
r"""The directed read replica selector. Callers must provide one or more
|
|
435
|
+
of the following fields for replica selection:
|
|
436
|
+
|
|
437
|
+
- ``location`` - The location must be one of the regions within the
|
|
438
|
+
multi-region configuration of your database.
|
|
439
|
+
- ``type`` - The type of the replica.
|
|
440
|
+
|
|
441
|
+
Some examples of using replica_selectors are:
|
|
442
|
+
|
|
443
|
+
- ``location:us-east1`` --> The "us-east1" replica(s) of any
|
|
444
|
+
available type will be used to process the request.
|
|
445
|
+
- ``type:READ_ONLY`` --> The "READ_ONLY" type replica(s) in nearest
|
|
446
|
+
available location will be used to process the request.
|
|
447
|
+
- ``location:us-east1 type:READ_ONLY`` --> The "READ_ONLY" type
|
|
448
|
+
replica(s) in location "us-east1" will be used to process the
|
|
449
|
+
request.
|
|
450
|
+
|
|
451
|
+
Attributes:
|
|
452
|
+
location (str):
|
|
453
|
+
The location or region of the serving
|
|
454
|
+
requests, e.g. "us-east1".
|
|
455
|
+
type_ (google.cloud.spanner_v1.types.DirectedReadOptions.ReplicaSelection.Type):
|
|
456
|
+
The type of replica.
|
|
457
|
+
"""
|
|
458
|
+
|
|
459
|
+
class Type(proto.Enum):
|
|
460
|
+
r"""Indicates the type of replica.
|
|
461
|
+
|
|
462
|
+
Values:
|
|
463
|
+
TYPE_UNSPECIFIED (0):
|
|
464
|
+
Not specified.
|
|
465
|
+
READ_WRITE (1):
|
|
466
|
+
Read-write replicas support both reads and
|
|
467
|
+
writes.
|
|
468
|
+
READ_ONLY (2):
|
|
469
|
+
Read-only replicas only support reads (not
|
|
470
|
+
writes).
|
|
471
|
+
"""
|
|
472
|
+
TYPE_UNSPECIFIED = 0
|
|
473
|
+
READ_WRITE = 1
|
|
474
|
+
READ_ONLY = 2
|
|
475
|
+
|
|
476
|
+
location: str = proto.Field(
|
|
477
|
+
proto.STRING,
|
|
478
|
+
number=1,
|
|
479
|
+
)
|
|
480
|
+
type_: "DirectedReadOptions.ReplicaSelection.Type" = proto.Field(
|
|
481
|
+
proto.ENUM,
|
|
482
|
+
number=2,
|
|
483
|
+
enum="DirectedReadOptions.ReplicaSelection.Type",
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
class IncludeReplicas(proto.Message):
|
|
487
|
+
r"""An IncludeReplicas contains a repeated set of
|
|
488
|
+
ReplicaSelection which indicates the order in which replicas
|
|
489
|
+
should be considered.
|
|
490
|
+
|
|
491
|
+
Attributes:
|
|
492
|
+
replica_selections (MutableSequence[google.cloud.spanner_v1.types.DirectedReadOptions.ReplicaSelection]):
|
|
493
|
+
The directed read replica selector.
|
|
494
|
+
auto_failover_disabled (bool):
|
|
495
|
+
If true, Spanner will not route requests to a replica
|
|
496
|
+
outside the include_replicas list when all of the specified
|
|
497
|
+
replicas are unavailable or unhealthy. Default value is
|
|
498
|
+
``false``.
|
|
499
|
+
"""
|
|
500
|
+
|
|
501
|
+
replica_selections: MutableSequence[
|
|
502
|
+
"DirectedReadOptions.ReplicaSelection"
|
|
503
|
+
] = proto.RepeatedField(
|
|
504
|
+
proto.MESSAGE,
|
|
505
|
+
number=1,
|
|
506
|
+
message="DirectedReadOptions.ReplicaSelection",
|
|
507
|
+
)
|
|
508
|
+
auto_failover_disabled: bool = proto.Field(
|
|
509
|
+
proto.BOOL,
|
|
510
|
+
number=2,
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
class ExcludeReplicas(proto.Message):
|
|
514
|
+
r"""An ExcludeReplicas contains a repeated set of
|
|
515
|
+
ReplicaSelection that should be excluded from serving requests.
|
|
516
|
+
|
|
517
|
+
Attributes:
|
|
518
|
+
replica_selections (MutableSequence[google.cloud.spanner_v1.types.DirectedReadOptions.ReplicaSelection]):
|
|
519
|
+
The directed read replica selector.
|
|
520
|
+
"""
|
|
521
|
+
|
|
522
|
+
replica_selections: MutableSequence[
|
|
523
|
+
"DirectedReadOptions.ReplicaSelection"
|
|
524
|
+
] = proto.RepeatedField(
|
|
525
|
+
proto.MESSAGE,
|
|
526
|
+
number=1,
|
|
527
|
+
message="DirectedReadOptions.ReplicaSelection",
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
include_replicas: IncludeReplicas = proto.Field(
|
|
531
|
+
proto.MESSAGE,
|
|
532
|
+
number=1,
|
|
533
|
+
oneof="replicas",
|
|
534
|
+
message=IncludeReplicas,
|
|
535
|
+
)
|
|
536
|
+
exclude_replicas: ExcludeReplicas = proto.Field(
|
|
537
|
+
proto.MESSAGE,
|
|
538
|
+
number=2,
|
|
539
|
+
oneof="replicas",
|
|
540
|
+
message=ExcludeReplicas,
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
class ExecuteSqlRequest(proto.Message):
|
|
545
|
+
r"""The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]
|
|
546
|
+
and
|
|
547
|
+
[ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
|
|
548
|
+
|
|
549
|
+
Attributes:
|
|
550
|
+
session (str):
|
|
551
|
+
Required. The session in which the SQL query
|
|
552
|
+
should be performed.
|
|
553
|
+
transaction (google.cloud.spanner_v1.types.TransactionSelector):
|
|
554
|
+
The transaction to use.
|
|
555
|
+
|
|
556
|
+
For queries, if none is provided, the default is
|
|
557
|
+
a temporary read-only transaction with strong
|
|
558
|
+
concurrency.
|
|
559
|
+
|
|
560
|
+
Standard DML statements require a read-write
|
|
561
|
+
transaction. To protect against replays,
|
|
562
|
+
single-use transactions are not supported. The
|
|
563
|
+
caller must either supply an existing
|
|
564
|
+
transaction ID or begin a new transaction.
|
|
565
|
+
|
|
566
|
+
Partitioned DML requires an existing Partitioned
|
|
567
|
+
DML transaction ID.
|
|
568
|
+
sql (str):
|
|
569
|
+
Required. The SQL string.
|
|
570
|
+
params (google.protobuf.struct_pb2.Struct):
|
|
571
|
+
Parameter names and values that bind to placeholders in the
|
|
572
|
+
SQL string.
|
|
573
|
+
|
|
574
|
+
A parameter placeholder consists of the ``@`` character
|
|
575
|
+
followed by the parameter name (for example,
|
|
576
|
+
``@firstName``). Parameter names must conform to the naming
|
|
577
|
+
requirements of identifiers as specified at
|
|
578
|
+
https://cloud.google.com/spanner/docs/lexical#identifiers.
|
|
579
|
+
|
|
580
|
+
Parameters can appear anywhere that a literal value is
|
|
581
|
+
expected. The same parameter name can be used more than
|
|
582
|
+
once, for example:
|
|
583
|
+
|
|
584
|
+
``"WHERE id > @msg_id AND id < @msg_id + 100"``
|
|
585
|
+
|
|
586
|
+
It is an error to execute a SQL statement with unbound
|
|
587
|
+
parameters.
|
|
588
|
+
param_types (MutableMapping[str, google.cloud.spanner_v1.types.Type]):
|
|
589
|
+
It is not always possible for Cloud Spanner to infer the
|
|
590
|
+
right SQL type from a JSON value. For example, values of
|
|
591
|
+
type ``BYTES`` and values of type ``STRING`` both appear in
|
|
592
|
+
[params][google.spanner.v1.ExecuteSqlRequest.params] as JSON
|
|
593
|
+
strings.
|
|
594
|
+
|
|
595
|
+
In these cases, ``param_types`` can be used to specify the
|
|
596
|
+
exact SQL type for some or all of the SQL statement
|
|
597
|
+
parameters. See the definition of
|
|
598
|
+
[Type][google.spanner.v1.Type] for more information about
|
|
599
|
+
SQL types.
|
|
600
|
+
resume_token (bytes):
|
|
601
|
+
If this request is resuming a previously interrupted SQL
|
|
602
|
+
statement execution, ``resume_token`` should be copied from
|
|
603
|
+
the last
|
|
604
|
+
[PartialResultSet][google.spanner.v1.PartialResultSet]
|
|
605
|
+
yielded before the interruption. Doing this enables the new
|
|
606
|
+
SQL statement execution to resume where the last one left
|
|
607
|
+
off. The rest of the request parameters must exactly match
|
|
608
|
+
the request that yielded this token.
|
|
609
|
+
query_mode (google.cloud.spanner_v1.types.ExecuteSqlRequest.QueryMode):
|
|
610
|
+
Used to control the amount of debugging information returned
|
|
611
|
+
in [ResultSetStats][google.spanner.v1.ResultSetStats]. If
|
|
612
|
+
[partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token]
|
|
613
|
+
is set,
|
|
614
|
+
[query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]
|
|
615
|
+
can only be set to
|
|
616
|
+
[QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
|
|
617
|
+
partition_token (bytes):
|
|
618
|
+
If present, results will be restricted to the specified
|
|
619
|
+
partition previously created using PartitionQuery(). There
|
|
620
|
+
must be an exact match for the values of fields common to
|
|
621
|
+
this message and the PartitionQueryRequest message used to
|
|
622
|
+
create this partition_token.
|
|
623
|
+
seqno (int):
|
|
624
|
+
A per-transaction sequence number used to
|
|
625
|
+
identify this request. This field makes each
|
|
626
|
+
request idempotent such that if the request is
|
|
627
|
+
received multiple times, at most one will
|
|
628
|
+
succeed.
|
|
629
|
+
|
|
630
|
+
The sequence number must be monotonically
|
|
631
|
+
increasing within the transaction. If a request
|
|
632
|
+
arrives for the first time with an out-of-order
|
|
633
|
+
sequence number, the transaction may be aborted.
|
|
634
|
+
Replays of previously handled requests will
|
|
635
|
+
yield the same response as the first execution.
|
|
636
|
+
|
|
637
|
+
Required for DML statements. Ignored for
|
|
638
|
+
queries.
|
|
639
|
+
query_options (google.cloud.spanner_v1.types.ExecuteSqlRequest.QueryOptions):
|
|
640
|
+
Query optimizer configuration to use for the
|
|
641
|
+
given query.
|
|
642
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
643
|
+
Common options for this request.
|
|
644
|
+
directed_read_options (google.cloud.spanner_v1.types.DirectedReadOptions):
|
|
645
|
+
Directed read options for this request.
|
|
646
|
+
data_boost_enabled (bool):
|
|
647
|
+
If this is for a partitioned query and this field is set to
|
|
648
|
+
``true``, the request is executed with Spanner Data Boost
|
|
649
|
+
independent compute resources.
|
|
650
|
+
|
|
651
|
+
If the field is set to ``true`` but the request does not set
|
|
652
|
+
``partition_token``, the API returns an ``INVALID_ARGUMENT``
|
|
653
|
+
error.
|
|
654
|
+
last_statement (bool):
|
|
655
|
+
Optional. If set to true, this statement
|
|
656
|
+
marks the end of the transaction. The
|
|
657
|
+
transaction should be committed or aborted after
|
|
658
|
+
this statement executes, and attempts to execute
|
|
659
|
+
any other requests against this transaction
|
|
660
|
+
(including reads and queries) will be rejected.
|
|
661
|
+
|
|
662
|
+
For DML statements, setting this option may
|
|
663
|
+
cause some error reporting to be deferred until
|
|
664
|
+
commit time (e.g. validation of unique
|
|
665
|
+
constraints). Given this, successful execution
|
|
666
|
+
of a DML statement should not be assumed until a
|
|
667
|
+
subsequent Commit call completes successfully.
|
|
668
|
+
"""
|
|
669
|
+
|
|
670
|
+
class QueryMode(proto.Enum):
|
|
671
|
+
r"""Mode in which the statement must be processed.
|
|
672
|
+
|
|
673
|
+
Values:
|
|
674
|
+
NORMAL (0):
|
|
675
|
+
The default mode. Only the statement results
|
|
676
|
+
are returned.
|
|
677
|
+
PLAN (1):
|
|
678
|
+
This mode returns only the query plan,
|
|
679
|
+
without any results or execution statistics
|
|
680
|
+
information.
|
|
681
|
+
PROFILE (2):
|
|
682
|
+
This mode returns the query plan, overall
|
|
683
|
+
execution statistics, operator level execution
|
|
684
|
+
statistics along with the results. This has a
|
|
685
|
+
performance overhead compared to the other
|
|
686
|
+
modes. It is not recommended to use this mode
|
|
687
|
+
for production traffic.
|
|
688
|
+
WITH_STATS (3):
|
|
689
|
+
This mode returns the overall (but not
|
|
690
|
+
operator-level) execution statistics along with
|
|
691
|
+
the results.
|
|
692
|
+
WITH_PLAN_AND_STATS (4):
|
|
693
|
+
This mode returns the query plan, overall
|
|
694
|
+
(but not operator-level) execution statistics
|
|
695
|
+
along with the results.
|
|
696
|
+
"""
|
|
697
|
+
NORMAL = 0
|
|
698
|
+
PLAN = 1
|
|
699
|
+
PROFILE = 2
|
|
700
|
+
WITH_STATS = 3
|
|
701
|
+
WITH_PLAN_AND_STATS = 4
|
|
702
|
+
|
|
703
|
+
class QueryOptions(proto.Message):
|
|
704
|
+
r"""Query optimizer configuration.
|
|
705
|
+
|
|
706
|
+
Attributes:
|
|
707
|
+
optimizer_version (str):
|
|
708
|
+
An option to control the selection of optimizer version.
|
|
709
|
+
|
|
710
|
+
This parameter allows individual queries to pick different
|
|
711
|
+
query optimizer versions.
|
|
712
|
+
|
|
713
|
+
Specifying ``latest`` as a value instructs Cloud Spanner to
|
|
714
|
+
use the latest supported query optimizer version. If not
|
|
715
|
+
specified, Cloud Spanner uses the optimizer version set at
|
|
716
|
+
the database level options. Any other positive integer (from
|
|
717
|
+
the list of supported optimizer versions) overrides the
|
|
718
|
+
default optimizer version for query execution.
|
|
719
|
+
|
|
720
|
+
The list of supported optimizer versions can be queried from
|
|
721
|
+
SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS.
|
|
722
|
+
|
|
723
|
+
Executing a SQL statement with an invalid optimizer version
|
|
724
|
+
fails with an ``INVALID_ARGUMENT`` error.
|
|
725
|
+
|
|
726
|
+
See
|
|
727
|
+
https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
|
|
728
|
+
for more information on managing the query optimizer.
|
|
729
|
+
|
|
730
|
+
The ``optimizer_version`` statement hint has precedence over
|
|
731
|
+
this setting.
|
|
732
|
+
optimizer_statistics_package (str):
|
|
733
|
+
An option to control the selection of optimizer statistics
|
|
734
|
+
package.
|
|
735
|
+
|
|
736
|
+
This parameter allows individual queries to use a different
|
|
737
|
+
query optimizer statistics package.
|
|
738
|
+
|
|
739
|
+
Specifying ``latest`` as a value instructs Cloud Spanner to
|
|
740
|
+
use the latest generated statistics package. If not
|
|
741
|
+
specified, Cloud Spanner uses the statistics package set at
|
|
742
|
+
the database level options, or the latest package if the
|
|
743
|
+
database option is not set.
|
|
744
|
+
|
|
745
|
+
The statistics package requested by the query has to be
|
|
746
|
+
exempt from garbage collection. This can be achieved with
|
|
747
|
+
the following DDL statement:
|
|
748
|
+
|
|
749
|
+
::
|
|
750
|
+
|
|
751
|
+
ALTER STATISTICS <package_name> SET OPTIONS (allow_gc=false)
|
|
752
|
+
|
|
753
|
+
The list of available statistics packages can be queried
|
|
754
|
+
from ``INFORMATION_SCHEMA.SPANNER_STATISTICS``.
|
|
755
|
+
|
|
756
|
+
Executing a SQL statement with an invalid optimizer
|
|
757
|
+
statistics package or with a statistics package that allows
|
|
758
|
+
garbage collection fails with an ``INVALID_ARGUMENT`` error.
|
|
759
|
+
"""
|
|
760
|
+
|
|
761
|
+
optimizer_version: str = proto.Field(
|
|
762
|
+
proto.STRING,
|
|
763
|
+
number=1,
|
|
764
|
+
)
|
|
765
|
+
optimizer_statistics_package: str = proto.Field(
|
|
766
|
+
proto.STRING,
|
|
767
|
+
number=2,
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
session: str = proto.Field(
|
|
771
|
+
proto.STRING,
|
|
772
|
+
number=1,
|
|
773
|
+
)
|
|
774
|
+
transaction: gs_transaction.TransactionSelector = proto.Field(
|
|
775
|
+
proto.MESSAGE,
|
|
776
|
+
number=2,
|
|
777
|
+
message=gs_transaction.TransactionSelector,
|
|
778
|
+
)
|
|
779
|
+
sql: str = proto.Field(
|
|
780
|
+
proto.STRING,
|
|
781
|
+
number=3,
|
|
782
|
+
)
|
|
783
|
+
params: struct_pb2.Struct = proto.Field(
|
|
784
|
+
proto.MESSAGE,
|
|
785
|
+
number=4,
|
|
786
|
+
message=struct_pb2.Struct,
|
|
787
|
+
)
|
|
788
|
+
param_types: MutableMapping[str, gs_type.Type] = proto.MapField(
|
|
789
|
+
proto.STRING,
|
|
790
|
+
proto.MESSAGE,
|
|
791
|
+
number=5,
|
|
792
|
+
message=gs_type.Type,
|
|
793
|
+
)
|
|
794
|
+
resume_token: bytes = proto.Field(
|
|
795
|
+
proto.BYTES,
|
|
796
|
+
number=6,
|
|
797
|
+
)
|
|
798
|
+
query_mode: QueryMode = proto.Field(
|
|
799
|
+
proto.ENUM,
|
|
800
|
+
number=7,
|
|
801
|
+
enum=QueryMode,
|
|
802
|
+
)
|
|
803
|
+
partition_token: bytes = proto.Field(
|
|
804
|
+
proto.BYTES,
|
|
805
|
+
number=8,
|
|
806
|
+
)
|
|
807
|
+
seqno: int = proto.Field(
|
|
808
|
+
proto.INT64,
|
|
809
|
+
number=9,
|
|
810
|
+
)
|
|
811
|
+
query_options: QueryOptions = proto.Field(
|
|
812
|
+
proto.MESSAGE,
|
|
813
|
+
number=10,
|
|
814
|
+
message=QueryOptions,
|
|
815
|
+
)
|
|
816
|
+
request_options: "RequestOptions" = proto.Field(
|
|
817
|
+
proto.MESSAGE,
|
|
818
|
+
number=11,
|
|
819
|
+
message="RequestOptions",
|
|
820
|
+
)
|
|
821
|
+
directed_read_options: "DirectedReadOptions" = proto.Field(
|
|
822
|
+
proto.MESSAGE,
|
|
823
|
+
number=15,
|
|
824
|
+
message="DirectedReadOptions",
|
|
825
|
+
)
|
|
826
|
+
data_boost_enabled: bool = proto.Field(
|
|
827
|
+
proto.BOOL,
|
|
828
|
+
number=16,
|
|
829
|
+
)
|
|
830
|
+
last_statement: bool = proto.Field(
|
|
831
|
+
proto.BOOL,
|
|
832
|
+
number=17,
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
class ExecuteBatchDmlRequest(proto.Message):
|
|
837
|
+
r"""The request for
|
|
838
|
+
[ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
|
|
839
|
+
|
|
840
|
+
Attributes:
|
|
841
|
+
session (str):
|
|
842
|
+
Required. The session in which the DML
|
|
843
|
+
statements should be performed.
|
|
844
|
+
transaction (google.cloud.spanner_v1.types.TransactionSelector):
|
|
845
|
+
Required. The transaction to use. Must be a
|
|
846
|
+
read-write transaction.
|
|
847
|
+
To protect against replays, single-use
|
|
848
|
+
transactions are not supported. The caller must
|
|
849
|
+
either supply an existing transaction ID or
|
|
850
|
+
begin a new transaction.
|
|
851
|
+
statements (MutableSequence[google.cloud.spanner_v1.types.ExecuteBatchDmlRequest.Statement]):
|
|
852
|
+
Required. The list of statements to execute in this batch.
|
|
853
|
+
Statements are executed serially, such that the effects of
|
|
854
|
+
statement ``i`` are visible to statement ``i+1``. Each
|
|
855
|
+
statement must be a DML statement. Execution stops at the
|
|
856
|
+
first failed statement; the remaining statements are not
|
|
857
|
+
executed.
|
|
858
|
+
|
|
859
|
+
Callers must provide at least one statement.
|
|
860
|
+
seqno (int):
|
|
861
|
+
Required. A per-transaction sequence number
|
|
862
|
+
used to identify this request. This field makes
|
|
863
|
+
each request idempotent such that if the request
|
|
864
|
+
is received multiple times, at most one will
|
|
865
|
+
succeed.
|
|
866
|
+
|
|
867
|
+
The sequence number must be monotonically
|
|
868
|
+
increasing within the transaction. If a request
|
|
869
|
+
arrives for the first time with an out-of-order
|
|
870
|
+
sequence number, the transaction may be aborted.
|
|
871
|
+
Replays of previously handled requests will
|
|
872
|
+
yield the same response as the first execution.
|
|
873
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
874
|
+
Common options for this request.
|
|
875
|
+
last_statements (bool):
|
|
876
|
+
Optional. If set to true, this request marks
|
|
877
|
+
the end of the transaction. The transaction
|
|
878
|
+
should be committed or aborted after these
|
|
879
|
+
statements execute, and attempts to execute any
|
|
880
|
+
other requests against this transaction
|
|
881
|
+
(including reads and queries) will be rejected.
|
|
882
|
+
|
|
883
|
+
Setting this option may cause some error
|
|
884
|
+
reporting to be deferred until commit time (e.g.
|
|
885
|
+
validation of unique constraints). Given this,
|
|
886
|
+
successful execution of statements should not be
|
|
887
|
+
assumed until a subsequent Commit call completes
|
|
888
|
+
successfully.
|
|
889
|
+
"""
|
|
890
|
+
|
|
891
|
+
class Statement(proto.Message):
|
|
892
|
+
r"""A single DML statement.
|
|
893
|
+
|
|
894
|
+
Attributes:
|
|
895
|
+
sql (str):
|
|
896
|
+
Required. The DML string.
|
|
897
|
+
params (google.protobuf.struct_pb2.Struct):
|
|
898
|
+
Parameter names and values that bind to placeholders in the
|
|
899
|
+
DML string.
|
|
900
|
+
|
|
901
|
+
A parameter placeholder consists of the ``@`` character
|
|
902
|
+
followed by the parameter name (for example,
|
|
903
|
+
``@firstName``). Parameter names can contain letters,
|
|
904
|
+
numbers, and underscores.
|
|
905
|
+
|
|
906
|
+
Parameters can appear anywhere that a literal value is
|
|
907
|
+
expected. The same parameter name can be used more than
|
|
908
|
+
once, for example:
|
|
909
|
+
|
|
910
|
+
``"WHERE id > @msg_id AND id < @msg_id + 100"``
|
|
911
|
+
|
|
912
|
+
It is an error to execute a SQL statement with unbound
|
|
913
|
+
parameters.
|
|
914
|
+
param_types (MutableMapping[str, google.cloud.spanner_v1.types.Type]):
|
|
915
|
+
It is not always possible for Cloud Spanner to infer the
|
|
916
|
+
right SQL type from a JSON value. For example, values of
|
|
917
|
+
type ``BYTES`` and values of type ``STRING`` both appear in
|
|
918
|
+
[params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params]
|
|
919
|
+
as JSON strings.
|
|
920
|
+
|
|
921
|
+
In these cases, ``param_types`` can be used to specify the
|
|
922
|
+
exact SQL type for some or all of the SQL statement
|
|
923
|
+
parameters. See the definition of
|
|
924
|
+
[Type][google.spanner.v1.Type] for more information about
|
|
925
|
+
SQL types.
|
|
926
|
+
"""
|
|
927
|
+
|
|
928
|
+
sql: str = proto.Field(
|
|
929
|
+
proto.STRING,
|
|
930
|
+
number=1,
|
|
931
|
+
)
|
|
932
|
+
params: struct_pb2.Struct = proto.Field(
|
|
933
|
+
proto.MESSAGE,
|
|
934
|
+
number=2,
|
|
935
|
+
message=struct_pb2.Struct,
|
|
936
|
+
)
|
|
937
|
+
param_types: MutableMapping[str, gs_type.Type] = proto.MapField(
|
|
938
|
+
proto.STRING,
|
|
939
|
+
proto.MESSAGE,
|
|
940
|
+
number=3,
|
|
941
|
+
message=gs_type.Type,
|
|
942
|
+
)
|
|
943
|
+
|
|
944
|
+
session: str = proto.Field(
|
|
945
|
+
proto.STRING,
|
|
946
|
+
number=1,
|
|
947
|
+
)
|
|
948
|
+
transaction: gs_transaction.TransactionSelector = proto.Field(
|
|
949
|
+
proto.MESSAGE,
|
|
950
|
+
number=2,
|
|
951
|
+
message=gs_transaction.TransactionSelector,
|
|
952
|
+
)
|
|
953
|
+
statements: MutableSequence[Statement] = proto.RepeatedField(
|
|
954
|
+
proto.MESSAGE,
|
|
955
|
+
number=3,
|
|
956
|
+
message=Statement,
|
|
957
|
+
)
|
|
958
|
+
seqno: int = proto.Field(
|
|
959
|
+
proto.INT64,
|
|
960
|
+
number=4,
|
|
961
|
+
)
|
|
962
|
+
request_options: "RequestOptions" = proto.Field(
|
|
963
|
+
proto.MESSAGE,
|
|
964
|
+
number=5,
|
|
965
|
+
message="RequestOptions",
|
|
966
|
+
)
|
|
967
|
+
last_statements: bool = proto.Field(
|
|
968
|
+
proto.BOOL,
|
|
969
|
+
number=6,
|
|
970
|
+
)
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
class ExecuteBatchDmlResponse(proto.Message):
|
|
974
|
+
r"""The response for
|
|
975
|
+
[ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
|
|
976
|
+
Contains a list of [ResultSet][google.spanner.v1.ResultSet]
|
|
977
|
+
messages, one for each DML statement that has successfully executed,
|
|
978
|
+
in the same order as the statements in the request. If a statement
|
|
979
|
+
fails, the status in the response body identifies the cause of the
|
|
980
|
+
failure.
|
|
981
|
+
|
|
982
|
+
To check for DML statements that failed, use the following approach:
|
|
983
|
+
|
|
984
|
+
1. Check the status in the response message. The
|
|
985
|
+
[google.rpc.Code][google.rpc.Code] enum value ``OK`` indicates
|
|
986
|
+
that all statements were executed successfully.
|
|
987
|
+
2. If the status was not ``OK``, check the number of result sets in
|
|
988
|
+
the response. If the response contains ``N``
|
|
989
|
+
[ResultSet][google.spanner.v1.ResultSet] messages, then statement
|
|
990
|
+
``N+1`` in the request failed.
|
|
991
|
+
|
|
992
|
+
Example 1:
|
|
993
|
+
|
|
994
|
+
- Request: 5 DML statements, all executed successfully.
|
|
995
|
+
- Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages,
|
|
996
|
+
with the status ``OK``.
|
|
997
|
+
|
|
998
|
+
Example 2:
|
|
999
|
+
|
|
1000
|
+
- Request: 5 DML statements. The third statement has a syntax
|
|
1001
|
+
error.
|
|
1002
|
+
- Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages,
|
|
1003
|
+
and a syntax error (``INVALID_ARGUMENT``) status. The number of
|
|
1004
|
+
[ResultSet][google.spanner.v1.ResultSet] messages indicates that
|
|
1005
|
+
the third statement failed, and the fourth and fifth statements
|
|
1006
|
+
were not executed.
|
|
1007
|
+
|
|
1008
|
+
Attributes:
|
|
1009
|
+
result_sets (MutableSequence[google.cloud.spanner_v1.types.ResultSet]):
|
|
1010
|
+
One [ResultSet][google.spanner.v1.ResultSet] for each
|
|
1011
|
+
statement in the request that ran successfully, in the same
|
|
1012
|
+
order as the statements in the request. Each
|
|
1013
|
+
[ResultSet][google.spanner.v1.ResultSet] does not contain
|
|
1014
|
+
any rows. The
|
|
1015
|
+
[ResultSetStats][google.spanner.v1.ResultSetStats] in each
|
|
1016
|
+
[ResultSet][google.spanner.v1.ResultSet] contain the number
|
|
1017
|
+
of rows modified by the statement.
|
|
1018
|
+
|
|
1019
|
+
Only the first [ResultSet][google.spanner.v1.ResultSet] in
|
|
1020
|
+
the response contains valid
|
|
1021
|
+
[ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
|
|
1022
|
+
status (google.rpc.status_pb2.Status):
|
|
1023
|
+
If all DML statements are executed successfully, the status
|
|
1024
|
+
is ``OK``. Otherwise, the error status of the first failed
|
|
1025
|
+
statement.
|
|
1026
|
+
precommit_token (google.cloud.spanner_v1.types.MultiplexedSessionPrecommitToken):
|
|
1027
|
+
Optional. A precommit token will be included if the
|
|
1028
|
+
read-write transaction is on a multiplexed session. The
|
|
1029
|
+
precommit token with the highest sequence number from this
|
|
1030
|
+
transaction attempt should be passed to the
|
|
1031
|
+
[Commit][google.spanner.v1.Spanner.Commit] request for this
|
|
1032
|
+
transaction. This feature is not yet supported and will
|
|
1033
|
+
result in an UNIMPLEMENTED error.
|
|
1034
|
+
"""
|
|
1035
|
+
|
|
1036
|
+
result_sets: MutableSequence[result_set.ResultSet] = proto.RepeatedField(
|
|
1037
|
+
proto.MESSAGE,
|
|
1038
|
+
number=1,
|
|
1039
|
+
message=result_set.ResultSet,
|
|
1040
|
+
)
|
|
1041
|
+
status: status_pb2.Status = proto.Field(
|
|
1042
|
+
proto.MESSAGE,
|
|
1043
|
+
number=2,
|
|
1044
|
+
message=status_pb2.Status,
|
|
1045
|
+
)
|
|
1046
|
+
precommit_token: gs_transaction.MultiplexedSessionPrecommitToken = proto.Field(
|
|
1047
|
+
proto.MESSAGE,
|
|
1048
|
+
number=3,
|
|
1049
|
+
message=gs_transaction.MultiplexedSessionPrecommitToken,
|
|
1050
|
+
)
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
class PartitionOptions(proto.Message):
|
|
1054
|
+
r"""Options for a PartitionQueryRequest and
|
|
1055
|
+
PartitionReadRequest.
|
|
1056
|
+
|
|
1057
|
+
Attributes:
|
|
1058
|
+
partition_size_bytes (int):
|
|
1059
|
+
**Note:** This hint is currently ignored by PartitionQuery
|
|
1060
|
+
and PartitionRead requests.
|
|
1061
|
+
|
|
1062
|
+
The desired data size for each partition generated. The
|
|
1063
|
+
default for this option is currently 1 GiB. This is only a
|
|
1064
|
+
hint. The actual size of each partition may be smaller or
|
|
1065
|
+
larger than this size request.
|
|
1066
|
+
max_partitions (int):
|
|
1067
|
+
**Note:** This hint is currently ignored by PartitionQuery
|
|
1068
|
+
and PartitionRead requests.
|
|
1069
|
+
|
|
1070
|
+
The desired maximum number of partitions to return. For
|
|
1071
|
+
example, this may be set to the number of workers available.
|
|
1072
|
+
The default for this option is currently 10,000. The maximum
|
|
1073
|
+
value is currently 200,000. This is only a hint. The actual
|
|
1074
|
+
number of partitions returned may be smaller or larger than
|
|
1075
|
+
this maximum count request.
|
|
1076
|
+
"""
|
|
1077
|
+
|
|
1078
|
+
partition_size_bytes: int = proto.Field(
|
|
1079
|
+
proto.INT64,
|
|
1080
|
+
number=1,
|
|
1081
|
+
)
|
|
1082
|
+
max_partitions: int = proto.Field(
|
|
1083
|
+
proto.INT64,
|
|
1084
|
+
number=2,
|
|
1085
|
+
)
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
class PartitionQueryRequest(proto.Message):
|
|
1089
|
+
r"""The request for
|
|
1090
|
+
[PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]
|
|
1091
|
+
|
|
1092
|
+
Attributes:
|
|
1093
|
+
session (str):
|
|
1094
|
+
Required. The session used to create the
|
|
1095
|
+
partitions.
|
|
1096
|
+
transaction (google.cloud.spanner_v1.types.TransactionSelector):
|
|
1097
|
+
Read only snapshot transactions are
|
|
1098
|
+
supported, read/write and single use
|
|
1099
|
+
transactions are not.
|
|
1100
|
+
sql (str):
|
|
1101
|
+
Required. The query request to generate partitions for. The
|
|
1102
|
+
request will fail if the query is not root partitionable.
|
|
1103
|
+
For a query to be root partitionable, it needs to satisfy a
|
|
1104
|
+
few conditions. For example, if the query execution plan
|
|
1105
|
+
contains a distributed union operator, then it must be the
|
|
1106
|
+
first operator in the plan. For more information about other
|
|
1107
|
+
conditions, see `Read data in
|
|
1108
|
+
parallel <https://cloud.google.com/spanner/docs/reads#read_data_in_parallel>`__.
|
|
1109
|
+
|
|
1110
|
+
The query request must not contain DML commands, such as
|
|
1111
|
+
INSERT, UPDATE, or DELETE. Use
|
|
1112
|
+
[ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
|
|
1113
|
+
with a PartitionedDml transaction for large,
|
|
1114
|
+
partition-friendly DML operations.
|
|
1115
|
+
params (google.protobuf.struct_pb2.Struct):
|
|
1116
|
+
Parameter names and values that bind to placeholders in the
|
|
1117
|
+
SQL string.
|
|
1118
|
+
|
|
1119
|
+
A parameter placeholder consists of the ``@`` character
|
|
1120
|
+
followed by the parameter name (for example,
|
|
1121
|
+
``@firstName``). Parameter names can contain letters,
|
|
1122
|
+
numbers, and underscores.
|
|
1123
|
+
|
|
1124
|
+
Parameters can appear anywhere that a literal value is
|
|
1125
|
+
expected. The same parameter name can be used more than
|
|
1126
|
+
once, for example:
|
|
1127
|
+
|
|
1128
|
+
``"WHERE id > @msg_id AND id < @msg_id + 100"``
|
|
1129
|
+
|
|
1130
|
+
It is an error to execute a SQL statement with unbound
|
|
1131
|
+
parameters.
|
|
1132
|
+
param_types (MutableMapping[str, google.cloud.spanner_v1.types.Type]):
|
|
1133
|
+
It is not always possible for Cloud Spanner to infer the
|
|
1134
|
+
right SQL type from a JSON value. For example, values of
|
|
1135
|
+
type ``BYTES`` and values of type ``STRING`` both appear in
|
|
1136
|
+
[params][google.spanner.v1.PartitionQueryRequest.params] as
|
|
1137
|
+
JSON strings.
|
|
1138
|
+
|
|
1139
|
+
In these cases, ``param_types`` can be used to specify the
|
|
1140
|
+
exact SQL type for some or all of the SQL query parameters.
|
|
1141
|
+
See the definition of [Type][google.spanner.v1.Type] for
|
|
1142
|
+
more information about SQL types.
|
|
1143
|
+
partition_options (google.cloud.spanner_v1.types.PartitionOptions):
|
|
1144
|
+
Additional options that affect how many
|
|
1145
|
+
partitions are created.
|
|
1146
|
+
"""
|
|
1147
|
+
|
|
1148
|
+
session: str = proto.Field(
|
|
1149
|
+
proto.STRING,
|
|
1150
|
+
number=1,
|
|
1151
|
+
)
|
|
1152
|
+
transaction: gs_transaction.TransactionSelector = proto.Field(
|
|
1153
|
+
proto.MESSAGE,
|
|
1154
|
+
number=2,
|
|
1155
|
+
message=gs_transaction.TransactionSelector,
|
|
1156
|
+
)
|
|
1157
|
+
sql: str = proto.Field(
|
|
1158
|
+
proto.STRING,
|
|
1159
|
+
number=3,
|
|
1160
|
+
)
|
|
1161
|
+
params: struct_pb2.Struct = proto.Field(
|
|
1162
|
+
proto.MESSAGE,
|
|
1163
|
+
number=4,
|
|
1164
|
+
message=struct_pb2.Struct,
|
|
1165
|
+
)
|
|
1166
|
+
param_types: MutableMapping[str, gs_type.Type] = proto.MapField(
|
|
1167
|
+
proto.STRING,
|
|
1168
|
+
proto.MESSAGE,
|
|
1169
|
+
number=5,
|
|
1170
|
+
message=gs_type.Type,
|
|
1171
|
+
)
|
|
1172
|
+
partition_options: "PartitionOptions" = proto.Field(
|
|
1173
|
+
proto.MESSAGE,
|
|
1174
|
+
number=6,
|
|
1175
|
+
message="PartitionOptions",
|
|
1176
|
+
)
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
class PartitionReadRequest(proto.Message):
|
|
1180
|
+
r"""The request for
|
|
1181
|
+
[PartitionRead][google.spanner.v1.Spanner.PartitionRead]
|
|
1182
|
+
|
|
1183
|
+
Attributes:
|
|
1184
|
+
session (str):
|
|
1185
|
+
Required. The session used to create the
|
|
1186
|
+
partitions.
|
|
1187
|
+
transaction (google.cloud.spanner_v1.types.TransactionSelector):
|
|
1188
|
+
Read only snapshot transactions are
|
|
1189
|
+
supported, read/write and single use
|
|
1190
|
+
transactions are not.
|
|
1191
|
+
table (str):
|
|
1192
|
+
Required. The name of the table in the
|
|
1193
|
+
database to be read.
|
|
1194
|
+
index (str):
|
|
1195
|
+
If non-empty, the name of an index on
|
|
1196
|
+
[table][google.spanner.v1.PartitionReadRequest.table]. This
|
|
1197
|
+
index is used instead of the table primary key when
|
|
1198
|
+
interpreting
|
|
1199
|
+
[key_set][google.spanner.v1.PartitionReadRequest.key_set]
|
|
1200
|
+
and sorting result rows. See
|
|
1201
|
+
[key_set][google.spanner.v1.PartitionReadRequest.key_set]
|
|
1202
|
+
for further information.
|
|
1203
|
+
columns (MutableSequence[str]):
|
|
1204
|
+
The columns of
|
|
1205
|
+
[table][google.spanner.v1.PartitionReadRequest.table] to be
|
|
1206
|
+
returned for each row matching this request.
|
|
1207
|
+
key_set (google.cloud.spanner_v1.types.KeySet):
|
|
1208
|
+
Required. ``key_set`` identifies the rows to be yielded.
|
|
1209
|
+
``key_set`` names the primary keys of the rows in
|
|
1210
|
+
[table][google.spanner.v1.PartitionReadRequest.table] to be
|
|
1211
|
+
yielded, unless
|
|
1212
|
+
[index][google.spanner.v1.PartitionReadRequest.index] is
|
|
1213
|
+
present. If
|
|
1214
|
+
[index][google.spanner.v1.PartitionReadRequest.index] is
|
|
1215
|
+
present, then
|
|
1216
|
+
[key_set][google.spanner.v1.PartitionReadRequest.key_set]
|
|
1217
|
+
instead names index keys in
|
|
1218
|
+
[index][google.spanner.v1.PartitionReadRequest.index].
|
|
1219
|
+
|
|
1220
|
+
It is not an error for the ``key_set`` to name rows that do
|
|
1221
|
+
not exist in the database. Read yields nothing for
|
|
1222
|
+
nonexistent rows.
|
|
1223
|
+
partition_options (google.cloud.spanner_v1.types.PartitionOptions):
|
|
1224
|
+
Additional options that affect how many
|
|
1225
|
+
partitions are created.
|
|
1226
|
+
"""
|
|
1227
|
+
|
|
1228
|
+
session: str = proto.Field(
|
|
1229
|
+
proto.STRING,
|
|
1230
|
+
number=1,
|
|
1231
|
+
)
|
|
1232
|
+
transaction: gs_transaction.TransactionSelector = proto.Field(
|
|
1233
|
+
proto.MESSAGE,
|
|
1234
|
+
number=2,
|
|
1235
|
+
message=gs_transaction.TransactionSelector,
|
|
1236
|
+
)
|
|
1237
|
+
table: str = proto.Field(
|
|
1238
|
+
proto.STRING,
|
|
1239
|
+
number=3,
|
|
1240
|
+
)
|
|
1241
|
+
index: str = proto.Field(
|
|
1242
|
+
proto.STRING,
|
|
1243
|
+
number=4,
|
|
1244
|
+
)
|
|
1245
|
+
columns: MutableSequence[str] = proto.RepeatedField(
|
|
1246
|
+
proto.STRING,
|
|
1247
|
+
number=5,
|
|
1248
|
+
)
|
|
1249
|
+
key_set: keys.KeySet = proto.Field(
|
|
1250
|
+
proto.MESSAGE,
|
|
1251
|
+
number=6,
|
|
1252
|
+
message=keys.KeySet,
|
|
1253
|
+
)
|
|
1254
|
+
partition_options: "PartitionOptions" = proto.Field(
|
|
1255
|
+
proto.MESSAGE,
|
|
1256
|
+
number=9,
|
|
1257
|
+
message="PartitionOptions",
|
|
1258
|
+
)
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
class Partition(proto.Message):
|
|
1262
|
+
r"""Information returned for each partition returned in a
|
|
1263
|
+
PartitionResponse.
|
|
1264
|
+
|
|
1265
|
+
Attributes:
|
|
1266
|
+
partition_token (bytes):
|
|
1267
|
+
This token can be passed to Read,
|
|
1268
|
+
StreamingRead, ExecuteSql, or
|
|
1269
|
+
ExecuteStreamingSql requests to restrict the
|
|
1270
|
+
results to those identified by this partition
|
|
1271
|
+
token.
|
|
1272
|
+
"""
|
|
1273
|
+
|
|
1274
|
+
partition_token: bytes = proto.Field(
|
|
1275
|
+
proto.BYTES,
|
|
1276
|
+
number=1,
|
|
1277
|
+
)
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
class PartitionResponse(proto.Message):
|
|
1281
|
+
r"""The response for
|
|
1282
|
+
[PartitionQuery][google.spanner.v1.Spanner.PartitionQuery] or
|
|
1283
|
+
[PartitionRead][google.spanner.v1.Spanner.PartitionRead]
|
|
1284
|
+
|
|
1285
|
+
Attributes:
|
|
1286
|
+
partitions (MutableSequence[google.cloud.spanner_v1.types.Partition]):
|
|
1287
|
+
Partitions created by this request.
|
|
1288
|
+
transaction (google.cloud.spanner_v1.types.Transaction):
|
|
1289
|
+
Transaction created by this request.
|
|
1290
|
+
"""
|
|
1291
|
+
|
|
1292
|
+
partitions: MutableSequence["Partition"] = proto.RepeatedField(
|
|
1293
|
+
proto.MESSAGE,
|
|
1294
|
+
number=1,
|
|
1295
|
+
message="Partition",
|
|
1296
|
+
)
|
|
1297
|
+
transaction: gs_transaction.Transaction = proto.Field(
|
|
1298
|
+
proto.MESSAGE,
|
|
1299
|
+
number=2,
|
|
1300
|
+
message=gs_transaction.Transaction,
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
class ReadRequest(proto.Message):
|
|
1305
|
+
r"""The request for [Read][google.spanner.v1.Spanner.Read] and
|
|
1306
|
+
[StreamingRead][google.spanner.v1.Spanner.StreamingRead].
|
|
1307
|
+
|
|
1308
|
+
Attributes:
|
|
1309
|
+
session (str):
|
|
1310
|
+
Required. The session in which the read
|
|
1311
|
+
should be performed.
|
|
1312
|
+
transaction (google.cloud.spanner_v1.types.TransactionSelector):
|
|
1313
|
+
The transaction to use. If none is provided,
|
|
1314
|
+
the default is a temporary read-only transaction
|
|
1315
|
+
with strong concurrency.
|
|
1316
|
+
table (str):
|
|
1317
|
+
Required. The name of the table in the
|
|
1318
|
+
database to be read.
|
|
1319
|
+
index (str):
|
|
1320
|
+
If non-empty, the name of an index on
|
|
1321
|
+
[table][google.spanner.v1.ReadRequest.table]. This index is
|
|
1322
|
+
used instead of the table primary key when interpreting
|
|
1323
|
+
[key_set][google.spanner.v1.ReadRequest.key_set] and sorting
|
|
1324
|
+
result rows. See
|
|
1325
|
+
[key_set][google.spanner.v1.ReadRequest.key_set] for further
|
|
1326
|
+
information.
|
|
1327
|
+
columns (MutableSequence[str]):
|
|
1328
|
+
Required. The columns of
|
|
1329
|
+
[table][google.spanner.v1.ReadRequest.table] to be returned
|
|
1330
|
+
for each row matching this request.
|
|
1331
|
+
key_set (google.cloud.spanner_v1.types.KeySet):
|
|
1332
|
+
Required. ``key_set`` identifies the rows to be yielded.
|
|
1333
|
+
``key_set`` names the primary keys of the rows in
|
|
1334
|
+
[table][google.spanner.v1.ReadRequest.table] to be yielded,
|
|
1335
|
+
unless [index][google.spanner.v1.ReadRequest.index] is
|
|
1336
|
+
present. If [index][google.spanner.v1.ReadRequest.index] is
|
|
1337
|
+
present, then
|
|
1338
|
+
[key_set][google.spanner.v1.ReadRequest.key_set] instead
|
|
1339
|
+
names index keys in
|
|
1340
|
+
[index][google.spanner.v1.ReadRequest.index].
|
|
1341
|
+
|
|
1342
|
+
If the
|
|
1343
|
+
[partition_token][google.spanner.v1.ReadRequest.partition_token]
|
|
1344
|
+
field is empty, rows are yielded in table primary key order
|
|
1345
|
+
(if [index][google.spanner.v1.ReadRequest.index] is empty)
|
|
1346
|
+
or index key order (if
|
|
1347
|
+
[index][google.spanner.v1.ReadRequest.index] is non-empty).
|
|
1348
|
+
If the
|
|
1349
|
+
[partition_token][google.spanner.v1.ReadRequest.partition_token]
|
|
1350
|
+
field is not empty, rows will be yielded in an unspecified
|
|
1351
|
+
order.
|
|
1352
|
+
|
|
1353
|
+
It is not an error for the ``key_set`` to name rows that do
|
|
1354
|
+
not exist in the database. Read yields nothing for
|
|
1355
|
+
nonexistent rows.
|
|
1356
|
+
limit (int):
|
|
1357
|
+
If greater than zero, only the first ``limit`` rows are
|
|
1358
|
+
yielded. If ``limit`` is zero, the default is no limit. A
|
|
1359
|
+
limit cannot be specified if ``partition_token`` is set.
|
|
1360
|
+
resume_token (bytes):
|
|
1361
|
+
If this request is resuming a previously interrupted read,
|
|
1362
|
+
``resume_token`` should be copied from the last
|
|
1363
|
+
[PartialResultSet][google.spanner.v1.PartialResultSet]
|
|
1364
|
+
yielded before the interruption. Doing this enables the new
|
|
1365
|
+
read to resume where the last read left off. The rest of the
|
|
1366
|
+
request parameters must exactly match the request that
|
|
1367
|
+
yielded this token.
|
|
1368
|
+
partition_token (bytes):
|
|
1369
|
+
If present, results will be restricted to the specified
|
|
1370
|
+
partition previously created using PartitionRead(). There
|
|
1371
|
+
must be an exact match for the values of fields common to
|
|
1372
|
+
this message and the PartitionReadRequest message used to
|
|
1373
|
+
create this partition_token.
|
|
1374
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
1375
|
+
Common options for this request.
|
|
1376
|
+
directed_read_options (google.cloud.spanner_v1.types.DirectedReadOptions):
|
|
1377
|
+
Directed read options for this request.
|
|
1378
|
+
data_boost_enabled (bool):
|
|
1379
|
+
If this is for a partitioned read and this field is set to
|
|
1380
|
+
``true``, the request is executed with Spanner Data Boost
|
|
1381
|
+
independent compute resources.
|
|
1382
|
+
|
|
1383
|
+
If the field is set to ``true`` but the request does not set
|
|
1384
|
+
``partition_token``, the API returns an ``INVALID_ARGUMENT``
|
|
1385
|
+
error.
|
|
1386
|
+
order_by (google.cloud.spanner_v1.types.ReadRequest.OrderBy):
|
|
1387
|
+
Optional. Order for the returned rows.
|
|
1388
|
+
|
|
1389
|
+
By default, Spanner will return result rows in primary key
|
|
1390
|
+
order except for PartitionRead requests. For applications
|
|
1391
|
+
that do not require rows to be returned in primary key
|
|
1392
|
+
(``ORDER_BY_PRIMARY_KEY``) order, setting
|
|
1393
|
+
``ORDER_BY_NO_ORDER`` option allows Spanner to optimize row
|
|
1394
|
+
retrieval, resulting in lower latencies in certain cases
|
|
1395
|
+
(e.g. bulk point lookups).
|
|
1396
|
+
lock_hint (google.cloud.spanner_v1.types.ReadRequest.LockHint):
|
|
1397
|
+
Optional. Lock Hint for the request, it can
|
|
1398
|
+
only be used with read-write transactions.
|
|
1399
|
+
"""
|
|
1400
|
+
|
|
1401
|
+
class OrderBy(proto.Enum):
|
|
1402
|
+
r"""An option to control the order in which rows are returned
|
|
1403
|
+
from a read.
|
|
1404
|
+
|
|
1405
|
+
Values:
|
|
1406
|
+
ORDER_BY_UNSPECIFIED (0):
|
|
1407
|
+
Default value.
|
|
1408
|
+
|
|
1409
|
+
ORDER_BY_UNSPECIFIED is equivalent to ORDER_BY_PRIMARY_KEY.
|
|
1410
|
+
ORDER_BY_PRIMARY_KEY (1):
|
|
1411
|
+
Read rows are returned in primary key order.
|
|
1412
|
+
|
|
1413
|
+
In the event that this option is used in conjunction with
|
|
1414
|
+
the ``partition_token`` field, the API will return an
|
|
1415
|
+
``INVALID_ARGUMENT`` error.
|
|
1416
|
+
ORDER_BY_NO_ORDER (2):
|
|
1417
|
+
Read rows are returned in any order.
|
|
1418
|
+
"""
|
|
1419
|
+
ORDER_BY_UNSPECIFIED = 0
|
|
1420
|
+
ORDER_BY_PRIMARY_KEY = 1
|
|
1421
|
+
ORDER_BY_NO_ORDER = 2
|
|
1422
|
+
|
|
1423
|
+
class LockHint(proto.Enum):
|
|
1424
|
+
r"""A lock hint mechanism for reads done within a transaction.
|
|
1425
|
+
|
|
1426
|
+
Values:
|
|
1427
|
+
LOCK_HINT_UNSPECIFIED (0):
|
|
1428
|
+
Default value.
|
|
1429
|
+
|
|
1430
|
+
LOCK_HINT_UNSPECIFIED is equivalent to LOCK_HINT_SHARED.
|
|
1431
|
+
LOCK_HINT_SHARED (1):
|
|
1432
|
+
Acquire shared locks.
|
|
1433
|
+
|
|
1434
|
+
By default when you perform a read as part of a read-write
|
|
1435
|
+
transaction, Spanner acquires shared read locks, which
|
|
1436
|
+
allows other reads to still access the data until your
|
|
1437
|
+
transaction is ready to commit. When your transaction is
|
|
1438
|
+
committing and writes are being applied, the transaction
|
|
1439
|
+
attempts to upgrade to an exclusive lock for any data you
|
|
1440
|
+
are writing. For more information about locks, see `Lock
|
|
1441
|
+
modes <https://cloud.google.com/spanner/docs/introspection/lock-statistics#explain-lock-modes>`__.
|
|
1442
|
+
LOCK_HINT_EXCLUSIVE (2):
|
|
1443
|
+
Acquire exclusive locks.
|
|
1444
|
+
|
|
1445
|
+
Requesting exclusive locks is beneficial if you observe high
|
|
1446
|
+
write contention, which means you notice that multiple
|
|
1447
|
+
transactions are concurrently trying to read and write to
|
|
1448
|
+
the same data, resulting in a large number of aborts. This
|
|
1449
|
+
problem occurs when two transactions initially acquire
|
|
1450
|
+
shared locks and then both try to upgrade to exclusive locks
|
|
1451
|
+
at the same time. In this situation both transactions are
|
|
1452
|
+
waiting for the other to give up their lock, resulting in a
|
|
1453
|
+
deadlocked situation. Spanner is able to detect this
|
|
1454
|
+
occurring and force one of the transactions to abort.
|
|
1455
|
+
However, this is a slow and expensive operation and results
|
|
1456
|
+
in lower performance. In this case it makes sense to acquire
|
|
1457
|
+
exclusive locks at the start of the transaction because then
|
|
1458
|
+
when multiple transactions try to act on the same data, they
|
|
1459
|
+
automatically get serialized. Each transaction waits its
|
|
1460
|
+
turn to acquire the lock and avoids getting into deadlock
|
|
1461
|
+
situations.
|
|
1462
|
+
|
|
1463
|
+
Because the exclusive lock hint is just a hint, it should
|
|
1464
|
+
not be considered equivalent to a mutex. In other words, you
|
|
1465
|
+
should not use Spanner exclusive locks as a mutual exclusion
|
|
1466
|
+
mechanism for the execution of code outside of Spanner.
|
|
1467
|
+
|
|
1468
|
+
**Note:** Request exclusive locks judiciously because they
|
|
1469
|
+
block others from reading that data for the entire
|
|
1470
|
+
transaction, rather than just when the writes are being
|
|
1471
|
+
performed. Unless you observe high write contention, you
|
|
1472
|
+
should use the default of shared read locks so you don't
|
|
1473
|
+
prematurely block other clients from reading the data that
|
|
1474
|
+
you're writing to.
|
|
1475
|
+
"""
|
|
1476
|
+
LOCK_HINT_UNSPECIFIED = 0
|
|
1477
|
+
LOCK_HINT_SHARED = 1
|
|
1478
|
+
LOCK_HINT_EXCLUSIVE = 2
|
|
1479
|
+
|
|
1480
|
+
session: str = proto.Field(
|
|
1481
|
+
proto.STRING,
|
|
1482
|
+
number=1,
|
|
1483
|
+
)
|
|
1484
|
+
transaction: gs_transaction.TransactionSelector = proto.Field(
|
|
1485
|
+
proto.MESSAGE,
|
|
1486
|
+
number=2,
|
|
1487
|
+
message=gs_transaction.TransactionSelector,
|
|
1488
|
+
)
|
|
1489
|
+
table: str = proto.Field(
|
|
1490
|
+
proto.STRING,
|
|
1491
|
+
number=3,
|
|
1492
|
+
)
|
|
1493
|
+
index: str = proto.Field(
|
|
1494
|
+
proto.STRING,
|
|
1495
|
+
number=4,
|
|
1496
|
+
)
|
|
1497
|
+
columns: MutableSequence[str] = proto.RepeatedField(
|
|
1498
|
+
proto.STRING,
|
|
1499
|
+
number=5,
|
|
1500
|
+
)
|
|
1501
|
+
key_set: keys.KeySet = proto.Field(
|
|
1502
|
+
proto.MESSAGE,
|
|
1503
|
+
number=6,
|
|
1504
|
+
message=keys.KeySet,
|
|
1505
|
+
)
|
|
1506
|
+
limit: int = proto.Field(
|
|
1507
|
+
proto.INT64,
|
|
1508
|
+
number=8,
|
|
1509
|
+
)
|
|
1510
|
+
resume_token: bytes = proto.Field(
|
|
1511
|
+
proto.BYTES,
|
|
1512
|
+
number=9,
|
|
1513
|
+
)
|
|
1514
|
+
partition_token: bytes = proto.Field(
|
|
1515
|
+
proto.BYTES,
|
|
1516
|
+
number=10,
|
|
1517
|
+
)
|
|
1518
|
+
request_options: "RequestOptions" = proto.Field(
|
|
1519
|
+
proto.MESSAGE,
|
|
1520
|
+
number=11,
|
|
1521
|
+
message="RequestOptions",
|
|
1522
|
+
)
|
|
1523
|
+
directed_read_options: "DirectedReadOptions" = proto.Field(
|
|
1524
|
+
proto.MESSAGE,
|
|
1525
|
+
number=14,
|
|
1526
|
+
message="DirectedReadOptions",
|
|
1527
|
+
)
|
|
1528
|
+
data_boost_enabled: bool = proto.Field(
|
|
1529
|
+
proto.BOOL,
|
|
1530
|
+
number=15,
|
|
1531
|
+
)
|
|
1532
|
+
order_by: OrderBy = proto.Field(
|
|
1533
|
+
proto.ENUM,
|
|
1534
|
+
number=16,
|
|
1535
|
+
enum=OrderBy,
|
|
1536
|
+
)
|
|
1537
|
+
lock_hint: LockHint = proto.Field(
|
|
1538
|
+
proto.ENUM,
|
|
1539
|
+
number=17,
|
|
1540
|
+
enum=LockHint,
|
|
1541
|
+
)
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
class BeginTransactionRequest(proto.Message):
|
|
1545
|
+
r"""The request for
|
|
1546
|
+
[BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
|
|
1547
|
+
|
|
1548
|
+
Attributes:
|
|
1549
|
+
session (str):
|
|
1550
|
+
Required. The session in which the
|
|
1551
|
+
transaction runs.
|
|
1552
|
+
options (google.cloud.spanner_v1.types.TransactionOptions):
|
|
1553
|
+
Required. Options for the new transaction.
|
|
1554
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
1555
|
+
Common options for this request. Priority is ignored for
|
|
1556
|
+
this request. Setting the priority in this request_options
|
|
1557
|
+
struct will not do anything. To set the priority for a
|
|
1558
|
+
transaction, set it on the reads and writes that are part of
|
|
1559
|
+
this transaction instead.
|
|
1560
|
+
mutation_key (google.cloud.spanner_v1.types.Mutation):
|
|
1561
|
+
Optional. Required for read-write
|
|
1562
|
+
transactions on a multiplexed session that
|
|
1563
|
+
commit mutations but do not perform any reads or
|
|
1564
|
+
queries. Clients should randomly select one of
|
|
1565
|
+
the mutations from the mutation set and send it
|
|
1566
|
+
as a part of this request.
|
|
1567
|
+
This feature is not yet supported and will
|
|
1568
|
+
result in an UNIMPLEMENTED error.
|
|
1569
|
+
"""
|
|
1570
|
+
|
|
1571
|
+
session: str = proto.Field(
|
|
1572
|
+
proto.STRING,
|
|
1573
|
+
number=1,
|
|
1574
|
+
)
|
|
1575
|
+
options: gs_transaction.TransactionOptions = proto.Field(
|
|
1576
|
+
proto.MESSAGE,
|
|
1577
|
+
number=2,
|
|
1578
|
+
message=gs_transaction.TransactionOptions,
|
|
1579
|
+
)
|
|
1580
|
+
request_options: "RequestOptions" = proto.Field(
|
|
1581
|
+
proto.MESSAGE,
|
|
1582
|
+
number=3,
|
|
1583
|
+
message="RequestOptions",
|
|
1584
|
+
)
|
|
1585
|
+
mutation_key: mutation.Mutation = proto.Field(
|
|
1586
|
+
proto.MESSAGE,
|
|
1587
|
+
number=4,
|
|
1588
|
+
message=mutation.Mutation,
|
|
1589
|
+
)
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
class CommitRequest(proto.Message):
|
|
1593
|
+
r"""The request for [Commit][google.spanner.v1.Spanner.Commit].
|
|
1594
|
+
|
|
1595
|
+
This message has `oneof`_ fields (mutually exclusive fields).
|
|
1596
|
+
For each oneof, at most one member field can be set at the same time.
|
|
1597
|
+
Setting any member of the oneof automatically clears all other
|
|
1598
|
+
members.
|
|
1599
|
+
|
|
1600
|
+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
|
|
1601
|
+
|
|
1602
|
+
Attributes:
|
|
1603
|
+
session (str):
|
|
1604
|
+
Required. The session in which the
|
|
1605
|
+
transaction to be committed is running.
|
|
1606
|
+
transaction_id (bytes):
|
|
1607
|
+
Commit a previously-started transaction.
|
|
1608
|
+
|
|
1609
|
+
This field is a member of `oneof`_ ``transaction``.
|
|
1610
|
+
single_use_transaction (google.cloud.spanner_v1.types.TransactionOptions):
|
|
1611
|
+
Execute mutations in a temporary transaction. Note that
|
|
1612
|
+
unlike commit of a previously-started transaction, commit
|
|
1613
|
+
with a temporary transaction is non-idempotent. That is, if
|
|
1614
|
+
the ``CommitRequest`` is sent to Cloud Spanner more than
|
|
1615
|
+
once (for instance, due to retries in the application, or in
|
|
1616
|
+
the transport library), it is possible that the mutations
|
|
1617
|
+
are executed more than once. If this is undesirable, use
|
|
1618
|
+
[BeginTransaction][google.spanner.v1.Spanner.BeginTransaction]
|
|
1619
|
+
and [Commit][google.spanner.v1.Spanner.Commit] instead.
|
|
1620
|
+
|
|
1621
|
+
This field is a member of `oneof`_ ``transaction``.
|
|
1622
|
+
mutations (MutableSequence[google.cloud.spanner_v1.types.Mutation]):
|
|
1623
|
+
The mutations to be executed when this
|
|
1624
|
+
transaction commits. All mutations are applied
|
|
1625
|
+
atomically, in the order they appear in this
|
|
1626
|
+
list.
|
|
1627
|
+
return_commit_stats (bool):
|
|
1628
|
+
If ``true``, then statistics related to the transaction will
|
|
1629
|
+
be included in the
|
|
1630
|
+
[CommitResponse][google.spanner.v1.CommitResponse.commit_stats].
|
|
1631
|
+
Default value is ``false``.
|
|
1632
|
+
max_commit_delay (google.protobuf.duration_pb2.Duration):
|
|
1633
|
+
Optional. The amount of latency this request
|
|
1634
|
+
is willing to incur in order to improve
|
|
1635
|
+
throughput. If this field is not set, Spanner
|
|
1636
|
+
assumes requests are relatively latency
|
|
1637
|
+
sensitive and automatically determines an
|
|
1638
|
+
appropriate delay time. You can specify a
|
|
1639
|
+
batching delay value between 0 and 500 ms.
|
|
1640
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
1641
|
+
Common options for this request.
|
|
1642
|
+
precommit_token (google.cloud.spanner_v1.types.MultiplexedSessionPrecommitToken):
|
|
1643
|
+
Optional. If the read-write transaction was
|
|
1644
|
+
executed on a multiplexed session, the precommit
|
|
1645
|
+
token with the highest sequence number received
|
|
1646
|
+
in this transaction attempt, should be included
|
|
1647
|
+
here. Failing to do so will result in a
|
|
1648
|
+
FailedPrecondition error.
|
|
1649
|
+
This feature is not yet supported and will
|
|
1650
|
+
result in an UNIMPLEMENTED error.
|
|
1651
|
+
"""
|
|
1652
|
+
|
|
1653
|
+
session: str = proto.Field(
|
|
1654
|
+
proto.STRING,
|
|
1655
|
+
number=1,
|
|
1656
|
+
)
|
|
1657
|
+
transaction_id: bytes = proto.Field(
|
|
1658
|
+
proto.BYTES,
|
|
1659
|
+
number=2,
|
|
1660
|
+
oneof="transaction",
|
|
1661
|
+
)
|
|
1662
|
+
single_use_transaction: gs_transaction.TransactionOptions = proto.Field(
|
|
1663
|
+
proto.MESSAGE,
|
|
1664
|
+
number=3,
|
|
1665
|
+
oneof="transaction",
|
|
1666
|
+
message=gs_transaction.TransactionOptions,
|
|
1667
|
+
)
|
|
1668
|
+
mutations: MutableSequence[mutation.Mutation] = proto.RepeatedField(
|
|
1669
|
+
proto.MESSAGE,
|
|
1670
|
+
number=4,
|
|
1671
|
+
message=mutation.Mutation,
|
|
1672
|
+
)
|
|
1673
|
+
return_commit_stats: bool = proto.Field(
|
|
1674
|
+
proto.BOOL,
|
|
1675
|
+
number=5,
|
|
1676
|
+
)
|
|
1677
|
+
max_commit_delay: duration_pb2.Duration = proto.Field(
|
|
1678
|
+
proto.MESSAGE,
|
|
1679
|
+
number=8,
|
|
1680
|
+
message=duration_pb2.Duration,
|
|
1681
|
+
)
|
|
1682
|
+
request_options: "RequestOptions" = proto.Field(
|
|
1683
|
+
proto.MESSAGE,
|
|
1684
|
+
number=6,
|
|
1685
|
+
message="RequestOptions",
|
|
1686
|
+
)
|
|
1687
|
+
precommit_token: gs_transaction.MultiplexedSessionPrecommitToken = proto.Field(
|
|
1688
|
+
proto.MESSAGE,
|
|
1689
|
+
number=9,
|
|
1690
|
+
message=gs_transaction.MultiplexedSessionPrecommitToken,
|
|
1691
|
+
)
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
class RollbackRequest(proto.Message):
|
|
1695
|
+
r"""The request for [Rollback][google.spanner.v1.Spanner.Rollback].
|
|
1696
|
+
|
|
1697
|
+
Attributes:
|
|
1698
|
+
session (str):
|
|
1699
|
+
Required. The session in which the
|
|
1700
|
+
transaction to roll back is running.
|
|
1701
|
+
transaction_id (bytes):
|
|
1702
|
+
Required. The transaction to roll back.
|
|
1703
|
+
"""
|
|
1704
|
+
|
|
1705
|
+
session: str = proto.Field(
|
|
1706
|
+
proto.STRING,
|
|
1707
|
+
number=1,
|
|
1708
|
+
)
|
|
1709
|
+
transaction_id: bytes = proto.Field(
|
|
1710
|
+
proto.BYTES,
|
|
1711
|
+
number=2,
|
|
1712
|
+
)
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
class BatchWriteRequest(proto.Message):
|
|
1716
|
+
r"""The request for [BatchWrite][google.spanner.v1.Spanner.BatchWrite].
|
|
1717
|
+
|
|
1718
|
+
Attributes:
|
|
1719
|
+
session (str):
|
|
1720
|
+
Required. The session in which the batch
|
|
1721
|
+
request is to be run.
|
|
1722
|
+
request_options (google.cloud.spanner_v1.types.RequestOptions):
|
|
1723
|
+
Common options for this request.
|
|
1724
|
+
mutation_groups (MutableSequence[google.cloud.spanner_v1.types.BatchWriteRequest.MutationGroup]):
|
|
1725
|
+
Required. The groups of mutations to be
|
|
1726
|
+
applied.
|
|
1727
|
+
exclude_txn_from_change_streams (bool):
|
|
1728
|
+
Optional. When ``exclude_txn_from_change_streams`` is set to
|
|
1729
|
+
``true``:
|
|
1730
|
+
|
|
1731
|
+
- Mutations from all transactions in this batch write
|
|
1732
|
+
operation will not be recorded in change streams with DDL
|
|
1733
|
+
option ``allow_txn_exclusion=true`` that are tracking
|
|
1734
|
+
columns modified by these transactions.
|
|
1735
|
+
- Mutations from all transactions in this batch write
|
|
1736
|
+
operation will be recorded in change streams with DDL
|
|
1737
|
+
option ``allow_txn_exclusion=false or not set`` that are
|
|
1738
|
+
tracking columns modified by these transactions.
|
|
1739
|
+
|
|
1740
|
+
When ``exclude_txn_from_change_streams`` is set to ``false``
|
|
1741
|
+
or not set, mutations from all transactions in this batch
|
|
1742
|
+
write operation will be recorded in all change streams that
|
|
1743
|
+
are tracking columns modified by these transactions.
|
|
1744
|
+
"""
|
|
1745
|
+
|
|
1746
|
+
class MutationGroup(proto.Message):
|
|
1747
|
+
r"""A group of mutations to be committed together. Related
|
|
1748
|
+
mutations should be placed in a group. For example, two
|
|
1749
|
+
mutations inserting rows with the same primary key prefix in
|
|
1750
|
+
both parent and child tables are related.
|
|
1751
|
+
|
|
1752
|
+
Attributes:
|
|
1753
|
+
mutations (MutableSequence[google.cloud.spanner_v1.types.Mutation]):
|
|
1754
|
+
Required. The mutations in this group.
|
|
1755
|
+
"""
|
|
1756
|
+
|
|
1757
|
+
mutations: MutableSequence[mutation.Mutation] = proto.RepeatedField(
|
|
1758
|
+
proto.MESSAGE,
|
|
1759
|
+
number=1,
|
|
1760
|
+
message=mutation.Mutation,
|
|
1761
|
+
)
|
|
1762
|
+
|
|
1763
|
+
session: str = proto.Field(
|
|
1764
|
+
proto.STRING,
|
|
1765
|
+
number=1,
|
|
1766
|
+
)
|
|
1767
|
+
request_options: "RequestOptions" = proto.Field(
|
|
1768
|
+
proto.MESSAGE,
|
|
1769
|
+
number=3,
|
|
1770
|
+
message="RequestOptions",
|
|
1771
|
+
)
|
|
1772
|
+
mutation_groups: MutableSequence[MutationGroup] = proto.RepeatedField(
|
|
1773
|
+
proto.MESSAGE,
|
|
1774
|
+
number=4,
|
|
1775
|
+
message=MutationGroup,
|
|
1776
|
+
)
|
|
1777
|
+
exclude_txn_from_change_streams: bool = proto.Field(
|
|
1778
|
+
proto.BOOL,
|
|
1779
|
+
number=5,
|
|
1780
|
+
)
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
class BatchWriteResponse(proto.Message):
|
|
1784
|
+
r"""The result of applying a batch of mutations.
|
|
1785
|
+
|
|
1786
|
+
Attributes:
|
|
1787
|
+
indexes (MutableSequence[int]):
|
|
1788
|
+
The mutation groups applied in this batch. The values index
|
|
1789
|
+
into the ``mutation_groups`` field in the corresponding
|
|
1790
|
+
``BatchWriteRequest``.
|
|
1791
|
+
status (google.rpc.status_pb2.Status):
|
|
1792
|
+
An ``OK`` status indicates success. Any other status
|
|
1793
|
+
indicates a failure.
|
|
1794
|
+
commit_timestamp (google.protobuf.timestamp_pb2.Timestamp):
|
|
1795
|
+
The commit timestamp of the transaction that applied this
|
|
1796
|
+
batch. Present if ``status`` is ``OK``, absent otherwise.
|
|
1797
|
+
"""
|
|
1798
|
+
|
|
1799
|
+
indexes: MutableSequence[int] = proto.RepeatedField(
|
|
1800
|
+
proto.INT32,
|
|
1801
|
+
number=1,
|
|
1802
|
+
)
|
|
1803
|
+
status: status_pb2.Status = proto.Field(
|
|
1804
|
+
proto.MESSAGE,
|
|
1805
|
+
number=2,
|
|
1806
|
+
message=status_pb2.Status,
|
|
1807
|
+
)
|
|
1808
|
+
commit_timestamp: timestamp_pb2.Timestamp = proto.Field(
|
|
1809
|
+
proto.MESSAGE,
|
|
1810
|
+
number=3,
|
|
1811
|
+
message=timestamp_pb2.Timestamp,
|
|
1812
|
+
)
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
__all__ = tuple(sorted(__protobuf__.manifest))
|