@google-cloud/spanner-api 0.1.0
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.
- package/README.md +111 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +80 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/location.proto +388 -0
- package/build/protos/google/spanner/v1/mutation.proto +156 -0
- package/build/protos/google/spanner/v1/query_plan.proto +156 -0
- package/build/protos/google/spanner/v1/result_set.proto +260 -0
- package/build/protos/google/spanner/v1/spanner.proto +1472 -0
- package/build/protos/google/spanner/v1/transaction.proto +329 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +42547 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/database_admin_client.d.ts +2433 -0
- package/build/src/v1/database_admin_client.js +2938 -0
- package/build/src/v1/database_admin_client.js.map +1 -0
- package/build/src/v1/database_admin_client_config.json +169 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +253 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/instance_admin_client.d.ts +2162 -0
- package/build/src/v1/instance_admin_client.js +2411 -0
- package/build/src/v1/instance_admin_client.js.map +1 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1353 -0
- package/build/src/v1/spanner_client.js +1456 -0
- package/build/src/v1/spanner_client.js.map +1 -0
- package/build/src/v1/spanner_client_config.json +123 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
- package/build/src/v1/spanner_executor_proxy_client.js +730 -0
- package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
- package/build/src/v1/spanner_proto_list.json +12 -0
- package/package.json +65 -0
|
@@ -0,0 +1,1472 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import public "google/spanner/v1/commit_response.proto";
|
|
20
|
+
|
|
21
|
+
import "google/api/annotations.proto";
|
|
22
|
+
import "google/api/client.proto";
|
|
23
|
+
import "google/api/field_behavior.proto";
|
|
24
|
+
import "google/api/resource.proto";
|
|
25
|
+
import "google/protobuf/duration.proto";
|
|
26
|
+
import "google/protobuf/empty.proto";
|
|
27
|
+
import "google/protobuf/struct.proto";
|
|
28
|
+
import "google/protobuf/timestamp.proto";
|
|
29
|
+
import "google/rpc/status.proto";
|
|
30
|
+
import "google/spanner/v1/keys.proto";
|
|
31
|
+
import "google/spanner/v1/location.proto";
|
|
32
|
+
import "google/spanner/v1/mutation.proto";
|
|
33
|
+
import "google/spanner/v1/result_set.proto";
|
|
34
|
+
import "google/spanner/v1/transaction.proto";
|
|
35
|
+
import "google/spanner/v1/type.proto";
|
|
36
|
+
|
|
37
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
38
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
39
|
+
option java_multiple_files = true;
|
|
40
|
+
option java_outer_classname = "SpannerProto";
|
|
41
|
+
option java_package = "com.google.spanner.v1";
|
|
42
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
43
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
44
|
+
option (google.api.resource_definition) = {
|
|
45
|
+
type: "spanner.googleapis.com/Database"
|
|
46
|
+
pattern: "projects/{project}/instances/{instance}/databases/{database}"
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Cloud Spanner API
|
|
50
|
+
//
|
|
51
|
+
// The Cloud Spanner API can be used to manage sessions and execute
|
|
52
|
+
// transactions on data stored in Cloud Spanner databases.
|
|
53
|
+
service Spanner {
|
|
54
|
+
option (google.api.default_host) = "spanner.googleapis.com";
|
|
55
|
+
option (google.api.oauth_scopes) =
|
|
56
|
+
"https://www.googleapis.com/auth/cloud-platform,"
|
|
57
|
+
"https://www.googleapis.com/auth/spanner.data";
|
|
58
|
+
|
|
59
|
+
// Creates a new session. A session can be used to perform
|
|
60
|
+
// transactions that read and/or modify data in a Cloud Spanner database.
|
|
61
|
+
// Sessions are meant to be reused for many consecutive
|
|
62
|
+
// transactions.
|
|
63
|
+
//
|
|
64
|
+
// Sessions can only execute one transaction at a time. To execute
|
|
65
|
+
// multiple concurrent read-write/write-only transactions, create
|
|
66
|
+
// multiple sessions. Note that standalone reads and queries use a
|
|
67
|
+
// transaction internally, and count toward the one transaction
|
|
68
|
+
// limit.
|
|
69
|
+
//
|
|
70
|
+
// Active sessions use additional server resources, so it's a good idea to
|
|
71
|
+
// delete idle and unneeded sessions.
|
|
72
|
+
// Aside from explicit deletes, Cloud Spanner can delete sessions when no
|
|
73
|
+
// operations are sent for more than an hour. If a session is deleted,
|
|
74
|
+
// requests to it return `NOT_FOUND`.
|
|
75
|
+
//
|
|
76
|
+
// Idle sessions can be kept alive by sending a trivial SQL query
|
|
77
|
+
// periodically, for example, `"SELECT 1"`.
|
|
78
|
+
rpc CreateSession(CreateSessionRequest) returns (Session) {
|
|
79
|
+
option (google.api.http) = {
|
|
80
|
+
post: "/v1/{database=projects/*/instances/*/databases/*}/sessions"
|
|
81
|
+
body: "*"
|
|
82
|
+
};
|
|
83
|
+
option (google.api.method_signature) = "database";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Creates multiple new sessions.
|
|
87
|
+
//
|
|
88
|
+
// This API can be used to initialize a session cache on the clients.
|
|
89
|
+
// See https://goo.gl/TgSFN2 for best practices on session cache management.
|
|
90
|
+
rpc BatchCreateSessions(BatchCreateSessionsRequest)
|
|
91
|
+
returns (BatchCreateSessionsResponse) {
|
|
92
|
+
option (google.api.http) = {
|
|
93
|
+
post: "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate"
|
|
94
|
+
body: "*"
|
|
95
|
+
};
|
|
96
|
+
option (google.api.method_signature) = "database,session_count";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Gets a session. Returns `NOT_FOUND` if the session doesn't exist.
|
|
100
|
+
// This is mainly useful for determining whether a session is still
|
|
101
|
+
// alive.
|
|
102
|
+
rpc GetSession(GetSessionRequest) returns (Session) {
|
|
103
|
+
option (google.api.http) = {
|
|
104
|
+
get: "/v1/{name=projects/*/instances/*/databases/*/sessions/*}"
|
|
105
|
+
};
|
|
106
|
+
option (google.api.method_signature) = "name";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Lists all sessions in a given database.
|
|
110
|
+
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) {
|
|
111
|
+
option (google.api.http) = {
|
|
112
|
+
get: "/v1/{database=projects/*/instances/*/databases/*}/sessions"
|
|
113
|
+
};
|
|
114
|
+
option (google.api.method_signature) = "database";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Ends a session, releasing server resources associated with it. This
|
|
118
|
+
// asynchronously triggers the cancellation of any operations that are running
|
|
119
|
+
// with this session.
|
|
120
|
+
rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) {
|
|
121
|
+
option (google.api.http) = {
|
|
122
|
+
delete: "/v1/{name=projects/*/instances/*/databases/*/sessions/*}"
|
|
123
|
+
};
|
|
124
|
+
option (google.api.method_signature) = "name";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Executes an SQL statement, returning all results in a single reply. This
|
|
128
|
+
// method can't be used to return a result set larger than 10 MiB;
|
|
129
|
+
// if the query yields more data than that, the query fails with
|
|
130
|
+
// a `FAILED_PRECONDITION` error.
|
|
131
|
+
//
|
|
132
|
+
// Operations inside read-write transactions might return `ABORTED`. If
|
|
133
|
+
// this occurs, the application should restart the transaction from
|
|
134
|
+
// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
|
|
135
|
+
// details.
|
|
136
|
+
//
|
|
137
|
+
// Larger result sets can be fetched in streaming fashion by calling
|
|
138
|
+
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
|
|
139
|
+
// instead.
|
|
140
|
+
//
|
|
141
|
+
// The query string can be SQL or [Graph Query Language
|
|
142
|
+
// (GQL)](https://cloud.google.com/spanner/docs/reference/standard-sql/graph-intro).
|
|
143
|
+
rpc ExecuteSql(ExecuteSqlRequest) returns (ResultSet) {
|
|
144
|
+
option (google.api.http) = {
|
|
145
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql"
|
|
146
|
+
body: "*"
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
|
|
151
|
+
// result set as a stream. Unlike
|
|
152
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
|
|
153
|
+
// the size of the returned result set. However, no individual row in the
|
|
154
|
+
// result set can exceed 100 MiB, and no column value can exceed 10 MiB.
|
|
155
|
+
//
|
|
156
|
+
// The query string can be SQL or [Graph Query Language
|
|
157
|
+
// (GQL)](https://cloud.google.com/spanner/docs/reference/standard-sql/graph-intro).
|
|
158
|
+
rpc ExecuteStreamingSql(ExecuteSqlRequest) returns (stream PartialResultSet) {
|
|
159
|
+
option (google.api.http) = {
|
|
160
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql"
|
|
161
|
+
body: "*"
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Executes a batch of SQL DML statements. This method allows many statements
|
|
166
|
+
// to be run with lower latency than submitting them sequentially with
|
|
167
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
|
|
168
|
+
//
|
|
169
|
+
// Statements are executed in sequential order. A request can succeed even if
|
|
170
|
+
// a statement fails. The
|
|
171
|
+
// [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status]
|
|
172
|
+
// field in the response provides information about the statement that failed.
|
|
173
|
+
// Clients must inspect this field to determine whether an error occurred.
|
|
174
|
+
//
|
|
175
|
+
// Execution stops after the first failed statement; the remaining statements
|
|
176
|
+
// are not executed.
|
|
177
|
+
rpc ExecuteBatchDml(ExecuteBatchDmlRequest)
|
|
178
|
+
returns (ExecuteBatchDmlResponse) {
|
|
179
|
+
option (google.api.http) = {
|
|
180
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml"
|
|
181
|
+
body: "*"
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Reads rows from the database using key lookups and scans, as a
|
|
186
|
+
// simple key/value style alternative to
|
|
187
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method can't be
|
|
188
|
+
// used to return a result set larger than 10 MiB; if the read matches more
|
|
189
|
+
// data than that, the read fails with a `FAILED_PRECONDITION`
|
|
190
|
+
// error.
|
|
191
|
+
//
|
|
192
|
+
// Reads inside read-write transactions might return `ABORTED`. If
|
|
193
|
+
// this occurs, the application should restart the transaction from
|
|
194
|
+
// the beginning. See [Transaction][google.spanner.v1.Transaction] for more
|
|
195
|
+
// details.
|
|
196
|
+
//
|
|
197
|
+
// Larger result sets can be yielded in streaming fashion by calling
|
|
198
|
+
// [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
|
|
199
|
+
rpc Read(ReadRequest) returns (ResultSet) {
|
|
200
|
+
option (google.api.http) = {
|
|
201
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read"
|
|
202
|
+
body: "*"
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
|
|
207
|
+
// as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
|
|
208
|
+
// limit on the size of the returned result set. However, no individual row in
|
|
209
|
+
// the result set can exceed 100 MiB, and no column value can exceed
|
|
210
|
+
// 10 MiB.
|
|
211
|
+
rpc StreamingRead(ReadRequest) returns (stream PartialResultSet) {
|
|
212
|
+
option (google.api.http) = {
|
|
213
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead"
|
|
214
|
+
body: "*"
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Begins a new transaction. This step can often be skipped:
|
|
219
|
+
// [Read][google.spanner.v1.Spanner.Read],
|
|
220
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
|
|
221
|
+
// [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
|
|
222
|
+
// side-effect.
|
|
223
|
+
rpc BeginTransaction(BeginTransactionRequest) returns (Transaction) {
|
|
224
|
+
option (google.api.http) = {
|
|
225
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction"
|
|
226
|
+
body: "*"
|
|
227
|
+
};
|
|
228
|
+
option (google.api.method_signature) = "session,options";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Commits a transaction. The request includes the mutations to be
|
|
232
|
+
// applied to rows in the database.
|
|
233
|
+
//
|
|
234
|
+
// `Commit` might return an `ABORTED` error. This can occur at any time;
|
|
235
|
+
// commonly, the cause is conflicts with concurrent
|
|
236
|
+
// transactions. However, it can also happen for a variety of other
|
|
237
|
+
// reasons. If `Commit` returns `ABORTED`, the caller should retry
|
|
238
|
+
// the transaction from the beginning, reusing the same session.
|
|
239
|
+
//
|
|
240
|
+
// On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
|
|
241
|
+
// for example, if the client job experiences a 1+ hour networking failure.
|
|
242
|
+
// At that point, Cloud Spanner has lost track of the transaction outcome and
|
|
243
|
+
// we recommend that you perform another read from the database to see the
|
|
244
|
+
// state of things as they are now.
|
|
245
|
+
rpc Commit(CommitRequest) returns (CommitResponse) {
|
|
246
|
+
option (google.api.http) = {
|
|
247
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit"
|
|
248
|
+
body: "*"
|
|
249
|
+
};
|
|
250
|
+
option (google.api.method_signature) = "session,transaction_id,mutations";
|
|
251
|
+
option (google.api.method_signature) =
|
|
252
|
+
"session,single_use_transaction,mutations";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Rolls back a transaction, releasing any locks it holds. It's a good
|
|
256
|
+
// idea to call this for any transaction that includes one or more
|
|
257
|
+
// [Read][google.spanner.v1.Spanner.Read] or
|
|
258
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
|
|
259
|
+
// decides not to commit.
|
|
260
|
+
//
|
|
261
|
+
// `Rollback` returns `OK` if it successfully aborts the transaction, the
|
|
262
|
+
// transaction was already aborted, or the transaction isn't
|
|
263
|
+
// found. `Rollback` never returns `ABORTED`.
|
|
264
|
+
rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) {
|
|
265
|
+
option (google.api.http) = {
|
|
266
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback"
|
|
267
|
+
body: "*"
|
|
268
|
+
};
|
|
269
|
+
option (google.api.method_signature) = "session,transaction_id";
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Creates a set of partition tokens that can be used to execute a query
|
|
273
|
+
// operation in parallel. Each of the returned partition tokens can be used
|
|
274
|
+
// by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
|
|
275
|
+
// specify a subset of the query result to read. The same session and
|
|
276
|
+
// read-only transaction must be used by the `PartitionQueryRequest` used to
|
|
277
|
+
// create the partition tokens and the `ExecuteSqlRequests` that use the
|
|
278
|
+
// partition tokens.
|
|
279
|
+
//
|
|
280
|
+
// Partition tokens become invalid when the session used to create them
|
|
281
|
+
// is deleted, is idle for too long, begins a new transaction, or becomes too
|
|
282
|
+
// old. When any of these happen, it isn't possible to resume the query, and
|
|
283
|
+
// the whole operation must be restarted from the beginning.
|
|
284
|
+
rpc PartitionQuery(PartitionQueryRequest) returns (PartitionResponse) {
|
|
285
|
+
option (google.api.http) = {
|
|
286
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionQuery"
|
|
287
|
+
body: "*"
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Creates a set of partition tokens that can be used to execute a read
|
|
292
|
+
// operation in parallel. Each of the returned partition tokens can be used
|
|
293
|
+
// by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
|
|
294
|
+
// subset of the read result to read. The same session and read-only
|
|
295
|
+
// transaction must be used by the `PartitionReadRequest` used to create the
|
|
296
|
+
// partition tokens and the `ReadRequests` that use the partition tokens.
|
|
297
|
+
// There are no ordering guarantees on rows returned among the returned
|
|
298
|
+
// partition tokens, or even within each individual `StreamingRead` call
|
|
299
|
+
// issued with a `partition_token`.
|
|
300
|
+
//
|
|
301
|
+
// Partition tokens become invalid when the session used to create them
|
|
302
|
+
// is deleted, is idle for too long, begins a new transaction, or becomes too
|
|
303
|
+
// old. When any of these happen, it isn't possible to resume the read, and
|
|
304
|
+
// the whole operation must be restarted from the beginning.
|
|
305
|
+
rpc PartitionRead(PartitionReadRequest) returns (PartitionResponse) {
|
|
306
|
+
option (google.api.http) = {
|
|
307
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionRead"
|
|
308
|
+
body: "*"
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Batches the supplied mutation groups in a collection of efficient
|
|
313
|
+
// transactions. All mutations in a group are committed atomically. However,
|
|
314
|
+
// mutations across groups can be committed non-atomically in an unspecified
|
|
315
|
+
// order and thus, they must be independent of each other. Partial failure is
|
|
316
|
+
// possible, that is, some groups might have been committed successfully,
|
|
317
|
+
// while some might have failed. The results of individual batches are
|
|
318
|
+
// streamed into the response as the batches are applied.
|
|
319
|
+
//
|
|
320
|
+
// `BatchWrite` requests are not replay protected, meaning that each mutation
|
|
321
|
+
// group can be applied more than once. Replays of non-idempotent mutations
|
|
322
|
+
// can have undesirable effects. For example, replays of an insert mutation
|
|
323
|
+
// can produce an already exists error or if you use generated or commit
|
|
324
|
+
// timestamp-based keys, it can result in additional rows being added to the
|
|
325
|
+
// mutation's table. We recommend structuring your mutation groups to be
|
|
326
|
+
// idempotent to avoid this issue.
|
|
327
|
+
rpc BatchWrite(BatchWriteRequest) returns (stream BatchWriteResponse) {
|
|
328
|
+
option (google.api.http) = {
|
|
329
|
+
post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:batchWrite"
|
|
330
|
+
body: "*"
|
|
331
|
+
};
|
|
332
|
+
option (google.api.method_signature) = "session,mutation_groups";
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// Retrieves a cache update for a given database.
|
|
336
|
+
//
|
|
337
|
+
// This RPC can be used to warm up the client cache by fetching key recipes
|
|
338
|
+
// and server information for a given database. It is recommended to call
|
|
339
|
+
// this RPC at the beginning of the client's lifecycle, prior to any other
|
|
340
|
+
// data plane operations.
|
|
341
|
+
//
|
|
342
|
+
// The cache update is returned as a stream because the response can be too
|
|
343
|
+
// large to fit into a single `CacheUpdate` message.
|
|
344
|
+
rpc FetchCacheUpdate(FetchCacheUpdateRequest) returns (stream CacheUpdate) {
|
|
345
|
+
option (google.api.http) = {
|
|
346
|
+
post: "/v1/{database=projects/*/instances/*/databases/*}:cacheUpdate"
|
|
347
|
+
body: "*"
|
|
348
|
+
};
|
|
349
|
+
option (google.api.method_signature) = "database";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// The request for [CreateSession][google.spanner.v1.Spanner.CreateSession].
|
|
354
|
+
message CreateSessionRequest {
|
|
355
|
+
// Required. The database in which the new session is created.
|
|
356
|
+
string database = 1 [
|
|
357
|
+
(google.api.field_behavior) = REQUIRED,
|
|
358
|
+
(google.api.resource_reference) = {
|
|
359
|
+
type: "spanner.googleapis.com/Database"
|
|
360
|
+
}
|
|
361
|
+
];
|
|
362
|
+
|
|
363
|
+
// Required. The session to create.
|
|
364
|
+
Session session = 2 [(google.api.field_behavior) = REQUIRED];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// The request for
|
|
368
|
+
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
|
|
369
|
+
message BatchCreateSessionsRequest {
|
|
370
|
+
// Required. The database in which the new sessions are created.
|
|
371
|
+
string database = 1 [
|
|
372
|
+
(google.api.field_behavior) = REQUIRED,
|
|
373
|
+
(google.api.resource_reference) = {
|
|
374
|
+
type: "spanner.googleapis.com/Database"
|
|
375
|
+
}
|
|
376
|
+
];
|
|
377
|
+
|
|
378
|
+
// Parameters to apply to each created session.
|
|
379
|
+
Session session_template = 2;
|
|
380
|
+
|
|
381
|
+
// Required. The number of sessions to be created in this batch call. At least
|
|
382
|
+
// one session is created. The API can return fewer than the requested number
|
|
383
|
+
// of sessions. If a specific number of sessions are desired, the client can
|
|
384
|
+
// make additional calls to `BatchCreateSessions` (adjusting
|
|
385
|
+
// [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
|
|
386
|
+
// as necessary).
|
|
387
|
+
int32 session_count = 3 [(google.api.field_behavior) = REQUIRED];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// The response for
|
|
391
|
+
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
|
|
392
|
+
message BatchCreateSessionsResponse {
|
|
393
|
+
// The freshly created sessions.
|
|
394
|
+
repeated Session session = 1;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// A session in the Cloud Spanner API.
|
|
398
|
+
message Session {
|
|
399
|
+
option (google.api.resource) = {
|
|
400
|
+
type: "spanner.googleapis.com/Session"
|
|
401
|
+
pattern: "projects/{project}/instances/{instance}/databases/{database}/sessions/{session}"
|
|
402
|
+
plural: "sessions"
|
|
403
|
+
singular: "session"
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// Output only. The name of the session. This is always system-assigned.
|
|
407
|
+
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
|
|
408
|
+
|
|
409
|
+
// The labels for the session.
|
|
410
|
+
//
|
|
411
|
+
// * Label keys must be between 1 and 63 characters long and must conform to
|
|
412
|
+
// the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
|
|
413
|
+
// * Label values must be between 0 and 63 characters long and must conform
|
|
414
|
+
// to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
|
|
415
|
+
// * No more than 64 labels can be associated with a given session.
|
|
416
|
+
//
|
|
417
|
+
// See https://goo.gl/xmQnxf for more information on and examples of labels.
|
|
418
|
+
map<string, string> labels = 2;
|
|
419
|
+
|
|
420
|
+
// Output only. The timestamp when the session is created.
|
|
421
|
+
google.protobuf.Timestamp create_time = 3
|
|
422
|
+
[(google.api.field_behavior) = OUTPUT_ONLY];
|
|
423
|
+
|
|
424
|
+
// Output only. The approximate timestamp when the session is last used. It's
|
|
425
|
+
// typically earlier than the actual last use time.
|
|
426
|
+
google.protobuf.Timestamp approximate_last_use_time = 4
|
|
427
|
+
[(google.api.field_behavior) = OUTPUT_ONLY];
|
|
428
|
+
|
|
429
|
+
// The database role which created this session.
|
|
430
|
+
string creator_role = 5;
|
|
431
|
+
|
|
432
|
+
// Optional. If `true`, specifies a multiplexed session. Use a multiplexed
|
|
433
|
+
// session for multiple, concurrent operations including any combination of
|
|
434
|
+
// read-only and read-write transactions. Use
|
|
435
|
+
// [`sessions.create`][google.spanner.v1.Spanner.CreateSession] to create
|
|
436
|
+
// multiplexed sessions. Don't use
|
|
437
|
+
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions] to
|
|
438
|
+
// create a multiplexed session. You can't delete or list multiplexed
|
|
439
|
+
// sessions.
|
|
440
|
+
bool multiplexed = 6 [(google.api.field_behavior) = OPTIONAL];
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// The request for [GetSession][google.spanner.v1.Spanner.GetSession].
|
|
444
|
+
message GetSessionRequest {
|
|
445
|
+
// Required. The name of the session to retrieve.
|
|
446
|
+
string name = 1 [
|
|
447
|
+
(google.api.field_behavior) = REQUIRED,
|
|
448
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
449
|
+
];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// The request for [ListSessions][google.spanner.v1.Spanner.ListSessions].
|
|
453
|
+
message ListSessionsRequest {
|
|
454
|
+
// Required. The database in which to list sessions.
|
|
455
|
+
string database = 1 [
|
|
456
|
+
(google.api.field_behavior) = REQUIRED,
|
|
457
|
+
(google.api.resource_reference) = {
|
|
458
|
+
type: "spanner.googleapis.com/Database"
|
|
459
|
+
}
|
|
460
|
+
];
|
|
461
|
+
|
|
462
|
+
// Number of sessions to be returned in the response. If 0 or less, defaults
|
|
463
|
+
// to the server's maximum allowed page size.
|
|
464
|
+
int32 page_size = 2;
|
|
465
|
+
|
|
466
|
+
// If non-empty, `page_token` should contain a
|
|
467
|
+
// [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token]
|
|
468
|
+
// from a previous
|
|
469
|
+
// [ListSessionsResponse][google.spanner.v1.ListSessionsResponse].
|
|
470
|
+
string page_token = 3;
|
|
471
|
+
|
|
472
|
+
// An expression for filtering the results of the request. Filter rules are
|
|
473
|
+
// case insensitive. The fields eligible for filtering are:
|
|
474
|
+
//
|
|
475
|
+
// * `labels.key` where key is the name of a label
|
|
476
|
+
//
|
|
477
|
+
// Some examples of using filters are:
|
|
478
|
+
//
|
|
479
|
+
// * `labels.env:*` --> The session has the label "env".
|
|
480
|
+
// * `labels.env:dev` --> The session has the label "env" and the value of
|
|
481
|
+
// the label contains the string "dev".
|
|
482
|
+
string filter = 4;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// The response for [ListSessions][google.spanner.v1.Spanner.ListSessions].
|
|
486
|
+
message ListSessionsResponse {
|
|
487
|
+
// The list of requested sessions.
|
|
488
|
+
repeated Session sessions = 1;
|
|
489
|
+
|
|
490
|
+
// `next_page_token` can be sent in a subsequent
|
|
491
|
+
// [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more
|
|
492
|
+
// of the matching sessions.
|
|
493
|
+
string next_page_token = 2;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// The request for [DeleteSession][google.spanner.v1.Spanner.DeleteSession].
|
|
497
|
+
message DeleteSessionRequest {
|
|
498
|
+
// Required. The name of the session to delete.
|
|
499
|
+
string name = 1 [
|
|
500
|
+
(google.api.field_behavior) = REQUIRED,
|
|
501
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
502
|
+
];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// Common request options for various APIs.
|
|
506
|
+
message RequestOptions {
|
|
507
|
+
// The relative priority for requests. Note that priority isn't applicable
|
|
508
|
+
// for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
|
|
509
|
+
//
|
|
510
|
+
// The priority acts as a hint to the Cloud Spanner scheduler and doesn't
|
|
511
|
+
// guarantee priority or order of execution. For example:
|
|
512
|
+
//
|
|
513
|
+
// * Some parts of a write operation always execute at `PRIORITY_HIGH`,
|
|
514
|
+
// regardless of the specified priority. This can cause you to see an
|
|
515
|
+
// increase in high priority workload even when executing a low priority
|
|
516
|
+
// request. This can also potentially cause a priority inversion where a
|
|
517
|
+
// lower priority request is fulfilled ahead of a higher priority
|
|
518
|
+
// request.
|
|
519
|
+
// * If a transaction contains multiple operations with different priorities,
|
|
520
|
+
// Cloud Spanner doesn't guarantee to process the higher priority
|
|
521
|
+
// operations first. There might be other constraints to satisfy, such as
|
|
522
|
+
// the order of operations.
|
|
523
|
+
enum Priority {
|
|
524
|
+
// `PRIORITY_UNSPECIFIED` is equivalent to `PRIORITY_HIGH`.
|
|
525
|
+
PRIORITY_UNSPECIFIED = 0;
|
|
526
|
+
|
|
527
|
+
// This specifies that the request is low priority.
|
|
528
|
+
PRIORITY_LOW = 1;
|
|
529
|
+
|
|
530
|
+
// This specifies that the request is medium priority.
|
|
531
|
+
PRIORITY_MEDIUM = 2;
|
|
532
|
+
|
|
533
|
+
// This specifies that the request is high priority.
|
|
534
|
+
PRIORITY_HIGH = 3;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// Container for various pieces of client-owned context attached to a request.
|
|
538
|
+
message ClientContext {
|
|
539
|
+
// Optional. Map of parameter name to value for this request. These values
|
|
540
|
+
// will be returned by any SECURE_CONTEXT() calls invoked by this request
|
|
541
|
+
// (e.g., by queries against Parameterized Secure Views).
|
|
542
|
+
map<string, google.protobuf.Value> secure_context = 1
|
|
543
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Priority for the request.
|
|
547
|
+
Priority priority = 1;
|
|
548
|
+
|
|
549
|
+
// A per-request tag which can be applied to queries or reads, used for
|
|
550
|
+
// statistics collection.
|
|
551
|
+
// Both `request_tag` and `transaction_tag` can be specified for a read or
|
|
552
|
+
// query that belongs to a transaction.
|
|
553
|
+
// This field is ignored for requests where it's not applicable (for example,
|
|
554
|
+
// `CommitRequest`).
|
|
555
|
+
// Legal characters for `request_tag` values are all printable characters
|
|
556
|
+
// (ASCII 32 - 126) and the length of a request_tag is limited to 50
|
|
557
|
+
// characters. Values that exceed this limit are truncated.
|
|
558
|
+
// Any leading underscore (_) characters are removed from the string.
|
|
559
|
+
string request_tag = 2;
|
|
560
|
+
|
|
561
|
+
// A tag used for statistics collection about this transaction.
|
|
562
|
+
// Both `request_tag` and `transaction_tag` can be specified for a read or
|
|
563
|
+
// query that belongs to a transaction.
|
|
564
|
+
// To enable tagging on a transaction, `transaction_tag` must be set to the
|
|
565
|
+
// same value for all requests belonging to the same transaction, including
|
|
566
|
+
// [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
|
|
567
|
+
// If this request doesn't belong to any transaction, `transaction_tag` is
|
|
568
|
+
// ignored.
|
|
569
|
+
// Legal characters for `transaction_tag` values are all printable characters
|
|
570
|
+
// (ASCII 32 - 126) and the length of a `transaction_tag` is limited to 50
|
|
571
|
+
// characters. Values that exceed this limit are truncated.
|
|
572
|
+
// Any leading underscore (_) characters are removed from the string.
|
|
573
|
+
string transaction_tag = 3;
|
|
574
|
+
|
|
575
|
+
// Optional. Optional context that may be needed for some requests.
|
|
576
|
+
ClientContext client_context = 4 [(google.api.field_behavior) = OPTIONAL];
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// The `DirectedReadOptions` can be used to indicate which replicas or regions
|
|
580
|
+
// should be used for non-transactional reads or queries.
|
|
581
|
+
//
|
|
582
|
+
// `DirectedReadOptions` can only be specified for a read-only transaction,
|
|
583
|
+
// otherwise the API returns an `INVALID_ARGUMENT` error.
|
|
584
|
+
message DirectedReadOptions {
|
|
585
|
+
// The directed read replica selector.
|
|
586
|
+
// Callers must provide one or more of the following fields for replica
|
|
587
|
+
// selection:
|
|
588
|
+
//
|
|
589
|
+
// * `location` - The location must be one of the regions within the
|
|
590
|
+
// multi-region configuration of your database.
|
|
591
|
+
// * `type` - The type of the replica.
|
|
592
|
+
//
|
|
593
|
+
// Some examples of using replica_selectors are:
|
|
594
|
+
//
|
|
595
|
+
// * `location:us-east1` --> The "us-east1" replica(s) of any available type
|
|
596
|
+
// is used to process the request.
|
|
597
|
+
// * `type:READ_ONLY` --> The "READ_ONLY" type replica(s) in the nearest
|
|
598
|
+
// available location are used to process the
|
|
599
|
+
// request.
|
|
600
|
+
// * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s)
|
|
601
|
+
// in location "us-east1" is used to process
|
|
602
|
+
// the request.
|
|
603
|
+
message ReplicaSelection {
|
|
604
|
+
// Indicates the type of replica.
|
|
605
|
+
enum Type {
|
|
606
|
+
// Not specified.
|
|
607
|
+
TYPE_UNSPECIFIED = 0;
|
|
608
|
+
|
|
609
|
+
// Read-write replicas support both reads and writes.
|
|
610
|
+
READ_WRITE = 1;
|
|
611
|
+
|
|
612
|
+
// Read-only replicas only support reads (not writes).
|
|
613
|
+
READ_ONLY = 2;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// The location or region of the serving requests, for example, "us-east1".
|
|
617
|
+
string location = 1;
|
|
618
|
+
|
|
619
|
+
// The type of replica.
|
|
620
|
+
Type type = 2;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// An `IncludeReplicas` contains a repeated set of `ReplicaSelection` which
|
|
624
|
+
// indicates the order in which replicas should be considered.
|
|
625
|
+
message IncludeReplicas {
|
|
626
|
+
// The directed read replica selector.
|
|
627
|
+
repeated ReplicaSelection replica_selections = 1;
|
|
628
|
+
|
|
629
|
+
// If `true`, Spanner doesn't route requests to a replica outside the
|
|
630
|
+
// <`include_replicas` list when all of the specified replicas are
|
|
631
|
+
// unavailable or unhealthy. Default value is `false`.
|
|
632
|
+
bool auto_failover_disabled = 2;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// An ExcludeReplicas contains a repeated set of ReplicaSelection that should
|
|
636
|
+
// be excluded from serving requests.
|
|
637
|
+
message ExcludeReplicas {
|
|
638
|
+
// The directed read replica selector.
|
|
639
|
+
repeated ReplicaSelection replica_selections = 1;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// Required. At most one of either `include_replicas` or `exclude_replicas`
|
|
643
|
+
// should be present in the message.
|
|
644
|
+
oneof replicas {
|
|
645
|
+
// `Include_replicas` indicates the order of replicas (as they appear in
|
|
646
|
+
// this list) to process the request. If `auto_failover_disabled` is set to
|
|
647
|
+
// `true` and all replicas are exhausted without finding a healthy replica,
|
|
648
|
+
// Spanner waits for a replica in the list to become available, requests
|
|
649
|
+
// might fail due to `DEADLINE_EXCEEDED` errors.
|
|
650
|
+
IncludeReplicas include_replicas = 1;
|
|
651
|
+
|
|
652
|
+
// `Exclude_replicas` indicates that specified replicas should be excluded
|
|
653
|
+
// from serving requests. Spanner doesn't route requests to the replicas
|
|
654
|
+
// in this list.
|
|
655
|
+
ExcludeReplicas exclude_replicas = 2;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
|
|
660
|
+
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
|
|
661
|
+
message ExecuteSqlRequest {
|
|
662
|
+
// Mode in which the statement must be processed.
|
|
663
|
+
enum QueryMode {
|
|
664
|
+
// The default mode. Only the statement results are returned.
|
|
665
|
+
NORMAL = 0;
|
|
666
|
+
|
|
667
|
+
// This mode returns only the query plan, without any results or
|
|
668
|
+
// execution statistics information.
|
|
669
|
+
PLAN = 1;
|
|
670
|
+
|
|
671
|
+
// This mode returns the query plan, overall execution statistics,
|
|
672
|
+
// operator level execution statistics along with the results. This has a
|
|
673
|
+
// performance overhead compared to the other modes. It isn't recommended
|
|
674
|
+
// to use this mode for production traffic.
|
|
675
|
+
PROFILE = 2;
|
|
676
|
+
|
|
677
|
+
// This mode returns the overall (but not operator-level) execution
|
|
678
|
+
// statistics along with the results.
|
|
679
|
+
WITH_STATS = 3;
|
|
680
|
+
|
|
681
|
+
// This mode returns the query plan, overall (but not operator-level)
|
|
682
|
+
// execution statistics along with the results.
|
|
683
|
+
WITH_PLAN_AND_STATS = 4;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// Query optimizer configuration.
|
|
687
|
+
message QueryOptions {
|
|
688
|
+
// An option to control the selection of optimizer version.
|
|
689
|
+
//
|
|
690
|
+
// This parameter allows individual queries to pick different query
|
|
691
|
+
// optimizer versions.
|
|
692
|
+
//
|
|
693
|
+
// Specifying `latest` as a value instructs Cloud Spanner to use the
|
|
694
|
+
// latest supported query optimizer version. If not specified, Cloud Spanner
|
|
695
|
+
// uses the optimizer version set at the database level options. Any other
|
|
696
|
+
// positive integer (from the list of supported optimizer versions)
|
|
697
|
+
// overrides the default optimizer version for query execution.
|
|
698
|
+
//
|
|
699
|
+
// The list of supported optimizer versions can be queried from
|
|
700
|
+
// `SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS`.
|
|
701
|
+
//
|
|
702
|
+
// Executing a SQL statement with an invalid optimizer version fails with
|
|
703
|
+
// an `INVALID_ARGUMENT` error.
|
|
704
|
+
//
|
|
705
|
+
// See
|
|
706
|
+
// https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
|
|
707
|
+
// for more information on managing the query optimizer.
|
|
708
|
+
//
|
|
709
|
+
// The `optimizer_version` statement hint has precedence over this setting.
|
|
710
|
+
string optimizer_version = 1;
|
|
711
|
+
|
|
712
|
+
// An option to control the selection of optimizer statistics package.
|
|
713
|
+
//
|
|
714
|
+
// This parameter allows individual queries to use a different query
|
|
715
|
+
// optimizer statistics package.
|
|
716
|
+
//
|
|
717
|
+
// Specifying `latest` as a value instructs Cloud Spanner to use the latest
|
|
718
|
+
// generated statistics package. If not specified, Cloud Spanner uses
|
|
719
|
+
// the statistics package set at the database level options, or the latest
|
|
720
|
+
// package if the database option isn't set.
|
|
721
|
+
//
|
|
722
|
+
// The statistics package requested by the query has to be exempt from
|
|
723
|
+
// garbage collection. This can be achieved with the following DDL
|
|
724
|
+
// statement:
|
|
725
|
+
//
|
|
726
|
+
// ```sql
|
|
727
|
+
// ALTER STATISTICS <package_name> SET OPTIONS (allow_gc=false)
|
|
728
|
+
// ```
|
|
729
|
+
//
|
|
730
|
+
// The list of available statistics packages can be queried from
|
|
731
|
+
// `INFORMATION_SCHEMA.SPANNER_STATISTICS`.
|
|
732
|
+
//
|
|
733
|
+
// Executing a SQL statement with an invalid optimizer statistics package
|
|
734
|
+
// or with a statistics package that allows garbage collection fails with
|
|
735
|
+
// an `INVALID_ARGUMENT` error.
|
|
736
|
+
string optimizer_statistics_package = 2;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Required. The session in which the SQL query should be performed.
|
|
740
|
+
string session = 1 [
|
|
741
|
+
(google.api.field_behavior) = REQUIRED,
|
|
742
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
743
|
+
];
|
|
744
|
+
|
|
745
|
+
// The transaction to use.
|
|
746
|
+
//
|
|
747
|
+
// For queries, if none is provided, the default is a temporary read-only
|
|
748
|
+
// transaction with strong concurrency.
|
|
749
|
+
//
|
|
750
|
+
// Standard DML statements require a read-write transaction. To protect
|
|
751
|
+
// against replays, single-use transactions are not supported. The caller
|
|
752
|
+
// must either supply an existing transaction ID or begin a new transaction.
|
|
753
|
+
//
|
|
754
|
+
// Partitioned DML requires an existing Partitioned DML transaction ID.
|
|
755
|
+
TransactionSelector transaction = 2;
|
|
756
|
+
|
|
757
|
+
// Required. The SQL string.
|
|
758
|
+
string sql = 3 [(google.api.field_behavior) = REQUIRED];
|
|
759
|
+
|
|
760
|
+
// Parameter names and values that bind to placeholders in the SQL string.
|
|
761
|
+
//
|
|
762
|
+
// A parameter placeholder consists of the `@` character followed by the
|
|
763
|
+
// parameter name (for example, `@firstName`). Parameter names must conform
|
|
764
|
+
// to the naming requirements of identifiers as specified at
|
|
765
|
+
// https://cloud.google.com/spanner/docs/lexical#identifiers.
|
|
766
|
+
//
|
|
767
|
+
// Parameters can appear anywhere that a literal value is expected. The same
|
|
768
|
+
// parameter name can be used more than once, for example:
|
|
769
|
+
//
|
|
770
|
+
// `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
|
771
|
+
//
|
|
772
|
+
// It's an error to execute a SQL statement with unbound parameters.
|
|
773
|
+
google.protobuf.Struct params = 4;
|
|
774
|
+
|
|
775
|
+
// It isn't always possible for Cloud Spanner to infer the right SQL type
|
|
776
|
+
// from a JSON value. For example, values of type `BYTES` and values
|
|
777
|
+
// of type `STRING` both appear in
|
|
778
|
+
// [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
|
|
779
|
+
//
|
|
780
|
+
// In these cases, you can use `param_types` to specify the exact
|
|
781
|
+
// SQL type for some or all of the SQL statement parameters. See the
|
|
782
|
+
// definition of [Type][google.spanner.v1.Type] for more information
|
|
783
|
+
// about SQL types.
|
|
784
|
+
map<string, Type> param_types = 5;
|
|
785
|
+
|
|
786
|
+
// If this request is resuming a previously interrupted SQL statement
|
|
787
|
+
// execution, `resume_token` should be copied from the last
|
|
788
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
|
|
789
|
+
// interruption. Doing this enables the new SQL statement execution to resume
|
|
790
|
+
// where the last one left off. The rest of the request parameters must
|
|
791
|
+
// exactly match the request that yielded this token.
|
|
792
|
+
bytes resume_token = 6;
|
|
793
|
+
|
|
794
|
+
// Used to control the amount of debugging information returned in
|
|
795
|
+
// [ResultSetStats][google.spanner.v1.ResultSetStats]. If
|
|
796
|
+
// [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is
|
|
797
|
+
// set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
|
|
798
|
+
// be set to
|
|
799
|
+
// [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
|
|
800
|
+
QueryMode query_mode = 7;
|
|
801
|
+
|
|
802
|
+
// If present, results are restricted to the specified partition
|
|
803
|
+
// previously created using `PartitionQuery`. There must be an exact
|
|
804
|
+
// match for the values of fields common to this message and the
|
|
805
|
+
// `PartitionQueryRequest` message used to create this `partition_token`.
|
|
806
|
+
bytes partition_token = 8;
|
|
807
|
+
|
|
808
|
+
// A per-transaction sequence number used to identify this request. This field
|
|
809
|
+
// makes each request idempotent such that if the request is received multiple
|
|
810
|
+
// times, at most one succeeds.
|
|
811
|
+
//
|
|
812
|
+
// The sequence number must be monotonically increasing within the
|
|
813
|
+
// transaction. If a request arrives for the first time with an out-of-order
|
|
814
|
+
// sequence number, the transaction can be aborted. Replays of previously
|
|
815
|
+
// handled requests yield the same response as the first execution.
|
|
816
|
+
//
|
|
817
|
+
// Required for DML statements. Ignored for queries.
|
|
818
|
+
int64 seqno = 9;
|
|
819
|
+
|
|
820
|
+
// Query optimizer configuration to use for the given query.
|
|
821
|
+
QueryOptions query_options = 10;
|
|
822
|
+
|
|
823
|
+
// Common options for this request.
|
|
824
|
+
RequestOptions request_options = 11;
|
|
825
|
+
|
|
826
|
+
// Directed read options for this request.
|
|
827
|
+
DirectedReadOptions directed_read_options = 15;
|
|
828
|
+
|
|
829
|
+
// If this is for a partitioned query and this field is set to `true`, the
|
|
830
|
+
// request is executed with Spanner Data Boost independent compute resources.
|
|
831
|
+
//
|
|
832
|
+
// If the field is set to `true` but the request doesn't set
|
|
833
|
+
// `partition_token`, the API returns an `INVALID_ARGUMENT` error.
|
|
834
|
+
bool data_boost_enabled = 16;
|
|
835
|
+
|
|
836
|
+
// Optional. If set to `true`, this statement marks the end of the
|
|
837
|
+
// transaction. After this statement executes, you must commit or abort the
|
|
838
|
+
// transaction. Attempts to execute any other requests against this
|
|
839
|
+
// transaction (including reads and queries) are rejected.
|
|
840
|
+
//
|
|
841
|
+
// For DML statements, setting this option might cause some error reporting to
|
|
842
|
+
// be deferred until commit time (for example, validation of unique
|
|
843
|
+
// constraints). Given this, successful execution of a DML statement shouldn't
|
|
844
|
+
// be assumed until a subsequent `Commit` call completes successfully.
|
|
845
|
+
bool last_statement = 17 [(google.api.field_behavior) = OPTIONAL];
|
|
846
|
+
|
|
847
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
848
|
+
//
|
|
849
|
+
// It gives the server hints that can be used to route the request
|
|
850
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
851
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
852
|
+
// filled in with accurate values.
|
|
853
|
+
RoutingHint routing_hint = 18 [(google.api.field_behavior) = OPTIONAL];
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
|
|
857
|
+
message ExecuteBatchDmlRequest {
|
|
858
|
+
// A single DML statement.
|
|
859
|
+
message Statement {
|
|
860
|
+
// Required. The DML string.
|
|
861
|
+
string sql = 1 [(google.api.field_behavior) = REQUIRED];
|
|
862
|
+
|
|
863
|
+
// Parameter names and values that bind to placeholders in the DML string.
|
|
864
|
+
//
|
|
865
|
+
// A parameter placeholder consists of the `@` character followed by the
|
|
866
|
+
// parameter name (for example, `@firstName`). Parameter names can contain
|
|
867
|
+
// letters, numbers, and underscores.
|
|
868
|
+
//
|
|
869
|
+
// Parameters can appear anywhere that a literal value is expected. The
|
|
870
|
+
// same parameter name can be used more than once, for example:
|
|
871
|
+
//
|
|
872
|
+
// `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
|
873
|
+
//
|
|
874
|
+
// It's an error to execute a SQL statement with unbound parameters.
|
|
875
|
+
google.protobuf.Struct params = 2;
|
|
876
|
+
|
|
877
|
+
// It isn't always possible for Cloud Spanner to infer the right SQL type
|
|
878
|
+
// from a JSON value. For example, values of type `BYTES` and values
|
|
879
|
+
// of type `STRING` both appear in
|
|
880
|
+
// [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as
|
|
881
|
+
// JSON strings.
|
|
882
|
+
//
|
|
883
|
+
// In these cases, `param_types` can be used to specify the exact
|
|
884
|
+
// SQL type for some or all of the SQL statement parameters. See the
|
|
885
|
+
// definition of [Type][google.spanner.v1.Type] for more information
|
|
886
|
+
// about SQL types.
|
|
887
|
+
map<string, Type> param_types = 3;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// Required. The session in which the DML statements should be performed.
|
|
891
|
+
string session = 1 [
|
|
892
|
+
(google.api.field_behavior) = REQUIRED,
|
|
893
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
894
|
+
];
|
|
895
|
+
|
|
896
|
+
// Required. The transaction to use. Must be a read-write transaction.
|
|
897
|
+
//
|
|
898
|
+
// To protect against replays, single-use transactions are not supported. The
|
|
899
|
+
// caller must either supply an existing transaction ID or begin a new
|
|
900
|
+
// transaction.
|
|
901
|
+
TransactionSelector transaction = 2 [(google.api.field_behavior) = REQUIRED];
|
|
902
|
+
|
|
903
|
+
// Required. The list of statements to execute in this batch. Statements are
|
|
904
|
+
// executed serially, such that the effects of statement `i` are visible to
|
|
905
|
+
// statement `i+1`. Each statement must be a DML statement. Execution stops at
|
|
906
|
+
// the first failed statement; the remaining statements are not executed.
|
|
907
|
+
//
|
|
908
|
+
// Callers must provide at least one statement.
|
|
909
|
+
repeated Statement statements = 3 [(google.api.field_behavior) = REQUIRED];
|
|
910
|
+
|
|
911
|
+
// Required. A per-transaction sequence number used to identify this request.
|
|
912
|
+
// This field makes each request idempotent such that if the request is
|
|
913
|
+
// received multiple times, at most one succeeds.
|
|
914
|
+
//
|
|
915
|
+
// The sequence number must be monotonically increasing within the
|
|
916
|
+
// transaction. If a request arrives for the first time with an out-of-order
|
|
917
|
+
// sequence number, the transaction might be aborted. Replays of previously
|
|
918
|
+
// handled requests yield the same response as the first execution.
|
|
919
|
+
int64 seqno = 4 [(google.api.field_behavior) = REQUIRED];
|
|
920
|
+
|
|
921
|
+
// Common options for this request.
|
|
922
|
+
RequestOptions request_options = 5;
|
|
923
|
+
|
|
924
|
+
// Optional. If set to `true`, this request marks the end of the transaction.
|
|
925
|
+
// After these statements execute, you must commit or abort the transaction.
|
|
926
|
+
// Attempts to execute any other requests against this transaction
|
|
927
|
+
// (including reads and queries) are rejected.
|
|
928
|
+
//
|
|
929
|
+
// Setting this option might cause some error reporting to be deferred until
|
|
930
|
+
// commit time (for example, validation of unique constraints). Given this,
|
|
931
|
+
// successful execution of statements shouldn't be assumed until a subsequent
|
|
932
|
+
// `Commit` call completes successfully.
|
|
933
|
+
bool last_statements = 6 [(google.api.field_behavior) = OPTIONAL];
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// The response for
|
|
937
|
+
// [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
|
|
938
|
+
// of [ResultSet][google.spanner.v1.ResultSet] messages, one for each DML
|
|
939
|
+
// statement that has successfully executed, in the same order as the statements
|
|
940
|
+
// in the request. If a statement fails, the status in the response body
|
|
941
|
+
// identifies the cause of the failure.
|
|
942
|
+
//
|
|
943
|
+
// To check for DML statements that failed, use the following approach:
|
|
944
|
+
//
|
|
945
|
+
// 1. Check the status in the response message. The
|
|
946
|
+
// [google.rpc.Code][google.rpc.Code] enum
|
|
947
|
+
// value `OK` indicates that all statements were executed successfully.
|
|
948
|
+
// 2. If the status was not `OK`, check the number of result sets in the
|
|
949
|
+
// response. If the response contains `N`
|
|
950
|
+
// [ResultSet][google.spanner.v1.ResultSet] messages, then statement `N+1` in
|
|
951
|
+
// the request failed.
|
|
952
|
+
//
|
|
953
|
+
// Example 1:
|
|
954
|
+
//
|
|
955
|
+
// * Request: 5 DML statements, all executed successfully.
|
|
956
|
+
// * Response: 5 [ResultSet][google.spanner.v1.ResultSet] messages, with the
|
|
957
|
+
// status `OK`.
|
|
958
|
+
//
|
|
959
|
+
// Example 2:
|
|
960
|
+
//
|
|
961
|
+
// * Request: 5 DML statements. The third statement has a syntax error.
|
|
962
|
+
// * Response: 2 [ResultSet][google.spanner.v1.ResultSet] messages, and a syntax
|
|
963
|
+
// error (`INVALID_ARGUMENT`)
|
|
964
|
+
// status. The number of [ResultSet][google.spanner.v1.ResultSet] messages
|
|
965
|
+
// indicates that the third statement failed, and the fourth and fifth
|
|
966
|
+
// statements were not executed.
|
|
967
|
+
message ExecuteBatchDmlResponse {
|
|
968
|
+
// One [ResultSet][google.spanner.v1.ResultSet] for each statement in the
|
|
969
|
+
// request that ran successfully, in the same order as the statements in the
|
|
970
|
+
// request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any
|
|
971
|
+
// rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each
|
|
972
|
+
// [ResultSet][google.spanner.v1.ResultSet] contain the number of rows
|
|
973
|
+
// modified by the statement.
|
|
974
|
+
//
|
|
975
|
+
// Only the first [ResultSet][google.spanner.v1.ResultSet] in the response
|
|
976
|
+
// contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
|
|
977
|
+
repeated ResultSet result_sets = 1;
|
|
978
|
+
|
|
979
|
+
// If all DML statements are executed successfully, the status is `OK`.
|
|
980
|
+
// Otherwise, the error status of the first failed statement.
|
|
981
|
+
google.rpc.Status status = 2;
|
|
982
|
+
|
|
983
|
+
// Optional. A precommit token is included if the read-write transaction
|
|
984
|
+
// is on a multiplexed session. Pass the precommit token with the highest
|
|
985
|
+
// sequence number from this transaction attempt should be passed to the
|
|
986
|
+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
|
|
987
|
+
MultiplexedSessionPrecommitToken precommit_token = 3
|
|
988
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// Options for a `PartitionQueryRequest` and `PartitionReadRequest`.
|
|
992
|
+
message PartitionOptions {
|
|
993
|
+
// **Note:** This hint is currently ignored by `PartitionQuery` and
|
|
994
|
+
// `PartitionRead` requests.
|
|
995
|
+
//
|
|
996
|
+
// The desired data size for each partition generated. The default for this
|
|
997
|
+
// option is currently 1 GiB. This is only a hint. The actual size of each
|
|
998
|
+
// partition can be smaller or larger than this size request.
|
|
999
|
+
int64 partition_size_bytes = 1;
|
|
1000
|
+
|
|
1001
|
+
// **Note:** This hint is currently ignored by `PartitionQuery` and
|
|
1002
|
+
// `PartitionRead` requests.
|
|
1003
|
+
//
|
|
1004
|
+
// The desired maximum number of partitions to return. For example, this
|
|
1005
|
+
// might be set to the number of workers available. The default for this
|
|
1006
|
+
// option is currently 10,000. The maximum value is currently 200,000. This
|
|
1007
|
+
// is only a hint. The actual number of partitions returned can be smaller or
|
|
1008
|
+
// larger than this maximum count request.
|
|
1009
|
+
int64 max_partitions = 2;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// The request for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]
|
|
1013
|
+
message PartitionQueryRequest {
|
|
1014
|
+
// Required. The session used to create the partitions.
|
|
1015
|
+
string session = 1 [
|
|
1016
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1017
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1018
|
+
];
|
|
1019
|
+
|
|
1020
|
+
// Read-only snapshot transactions are supported, read and write and
|
|
1021
|
+
// single-use transactions are not.
|
|
1022
|
+
TransactionSelector transaction = 2;
|
|
1023
|
+
|
|
1024
|
+
// Required. The query request to generate partitions for. The request fails
|
|
1025
|
+
// if the query isn't root partitionable. For a query to be root
|
|
1026
|
+
// partitionable, it needs to satisfy a few conditions. For example, if the
|
|
1027
|
+
// query execution plan contains a distributed union operator, then it must be
|
|
1028
|
+
// the first operator in the plan. For more information about other
|
|
1029
|
+
// conditions, see [Read data in
|
|
1030
|
+
// parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel).
|
|
1031
|
+
//
|
|
1032
|
+
// The query request must not contain DML commands, such as `INSERT`,
|
|
1033
|
+
// `UPDATE`, or `DELETE`. Use
|
|
1034
|
+
// [`ExecuteStreamingSql`][google.spanner.v1.Spanner.ExecuteStreamingSql] with
|
|
1035
|
+
// a `PartitionedDml` transaction for large, partition-friendly DML
|
|
1036
|
+
// operations.
|
|
1037
|
+
string sql = 3 [(google.api.field_behavior) = REQUIRED];
|
|
1038
|
+
|
|
1039
|
+
// Optional. Parameter names and values that bind to placeholders in the SQL
|
|
1040
|
+
// string.
|
|
1041
|
+
//
|
|
1042
|
+
// A parameter placeholder consists of the `@` character followed by the
|
|
1043
|
+
// parameter name (for example, `@firstName`). Parameter names can contain
|
|
1044
|
+
// letters, numbers, and underscores.
|
|
1045
|
+
//
|
|
1046
|
+
// Parameters can appear anywhere that a literal value is expected. The same
|
|
1047
|
+
// parameter name can be used more than once, for example:
|
|
1048
|
+
//
|
|
1049
|
+
// `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
|
1050
|
+
//
|
|
1051
|
+
// It's an error to execute a SQL statement with unbound parameters.
|
|
1052
|
+
google.protobuf.Struct params = 4 [(google.api.field_behavior) = OPTIONAL];
|
|
1053
|
+
|
|
1054
|
+
// Optional. It isn't always possible for Cloud Spanner to infer the right SQL
|
|
1055
|
+
// type from a JSON value. For example, values of type `BYTES` and values of
|
|
1056
|
+
// type `STRING` both appear in
|
|
1057
|
+
// [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings.
|
|
1058
|
+
//
|
|
1059
|
+
// In these cases, `param_types` can be used to specify the exact
|
|
1060
|
+
// SQL type for some or all of the SQL query parameters. See the
|
|
1061
|
+
// definition of [Type][google.spanner.v1.Type] for more information
|
|
1062
|
+
// about SQL types.
|
|
1063
|
+
map<string, Type> param_types = 5 [(google.api.field_behavior) = OPTIONAL];
|
|
1064
|
+
|
|
1065
|
+
// Additional options that affect how many partitions are created.
|
|
1066
|
+
PartitionOptions partition_options = 6;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// The request for [PartitionRead][google.spanner.v1.Spanner.PartitionRead]
|
|
1070
|
+
message PartitionReadRequest {
|
|
1071
|
+
// Required. The session used to create the partitions.
|
|
1072
|
+
string session = 1 [
|
|
1073
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1074
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1075
|
+
];
|
|
1076
|
+
|
|
1077
|
+
// Read only snapshot transactions are supported, read/write and single use
|
|
1078
|
+
// transactions are not.
|
|
1079
|
+
TransactionSelector transaction = 2;
|
|
1080
|
+
|
|
1081
|
+
// Required. The name of the table in the database to be read.
|
|
1082
|
+
string table = 3 [(google.api.field_behavior) = REQUIRED];
|
|
1083
|
+
|
|
1084
|
+
// If non-empty, the name of an index on
|
|
1085
|
+
// [table][google.spanner.v1.PartitionReadRequest.table]. This index is used
|
|
1086
|
+
// instead of the table primary key when interpreting
|
|
1087
|
+
// [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting
|
|
1088
|
+
// result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set]
|
|
1089
|
+
// for further information.
|
|
1090
|
+
string index = 4;
|
|
1091
|
+
|
|
1092
|
+
// The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be
|
|
1093
|
+
// returned for each row matching this request.
|
|
1094
|
+
repeated string columns = 5;
|
|
1095
|
+
|
|
1096
|
+
// Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
|
1097
|
+
// primary keys of the rows in
|
|
1098
|
+
// [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless
|
|
1099
|
+
// [index][google.spanner.v1.PartitionReadRequest.index] is present. If
|
|
1100
|
+
// [index][google.spanner.v1.PartitionReadRequest.index] is present, then
|
|
1101
|
+
// [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names
|
|
1102
|
+
// index keys in [index][google.spanner.v1.PartitionReadRequest.index].
|
|
1103
|
+
//
|
|
1104
|
+
// It isn't an error for the `key_set` to name rows that don't
|
|
1105
|
+
// exist in the database. Read yields nothing for nonexistent rows.
|
|
1106
|
+
KeySet key_set = 6 [(google.api.field_behavior) = REQUIRED];
|
|
1107
|
+
|
|
1108
|
+
// Additional options that affect how many partitions are created.
|
|
1109
|
+
PartitionOptions partition_options = 9;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// Information returned for each partition returned in a
|
|
1113
|
+
// PartitionResponse.
|
|
1114
|
+
message Partition {
|
|
1115
|
+
// This token can be passed to `Read`, `StreamingRead`, `ExecuteSql`, or
|
|
1116
|
+
// `ExecuteStreamingSql` requests to restrict the results to those identified
|
|
1117
|
+
// by this partition token.
|
|
1118
|
+
bytes partition_token = 1;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
// The response for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]
|
|
1122
|
+
// or [PartitionRead][google.spanner.v1.Spanner.PartitionRead]
|
|
1123
|
+
message PartitionResponse {
|
|
1124
|
+
// Partitions created by this request.
|
|
1125
|
+
repeated Partition partitions = 1;
|
|
1126
|
+
|
|
1127
|
+
// Transaction created by this request.
|
|
1128
|
+
Transaction transaction = 2;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// The request for [Read][google.spanner.v1.Spanner.Read] and
|
|
1132
|
+
// [StreamingRead][google.spanner.v1.Spanner.StreamingRead].
|
|
1133
|
+
message ReadRequest {
|
|
1134
|
+
// An option to control the order in which rows are returned from a read.
|
|
1135
|
+
enum OrderBy {
|
|
1136
|
+
// Default value.
|
|
1137
|
+
//
|
|
1138
|
+
// `ORDER_BY_UNSPECIFIED` is equivalent to `ORDER_BY_PRIMARY_KEY`.
|
|
1139
|
+
ORDER_BY_UNSPECIFIED = 0;
|
|
1140
|
+
|
|
1141
|
+
// Read rows are returned in primary key order.
|
|
1142
|
+
//
|
|
1143
|
+
// In the event that this option is used in conjunction with the
|
|
1144
|
+
// `partition_token` field, the API returns an `INVALID_ARGUMENT` error.
|
|
1145
|
+
ORDER_BY_PRIMARY_KEY = 1;
|
|
1146
|
+
|
|
1147
|
+
// Read rows are returned in any order.
|
|
1148
|
+
ORDER_BY_NO_ORDER = 2;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// A lock hint mechanism for reads done within a transaction.
|
|
1152
|
+
enum LockHint {
|
|
1153
|
+
// Default value.
|
|
1154
|
+
//
|
|
1155
|
+
// `LOCK_HINT_UNSPECIFIED` is equivalent to `LOCK_HINT_SHARED`.
|
|
1156
|
+
LOCK_HINT_UNSPECIFIED = 0;
|
|
1157
|
+
|
|
1158
|
+
// Acquire shared locks.
|
|
1159
|
+
//
|
|
1160
|
+
// By default when you perform a read as part of a read-write transaction,
|
|
1161
|
+
// Spanner acquires shared read locks, which allows other reads to still
|
|
1162
|
+
// access the data until your transaction is ready to commit. When your
|
|
1163
|
+
// transaction is committing and writes are being applied, the transaction
|
|
1164
|
+
// attempts to upgrade to an exclusive lock for any data you are writing.
|
|
1165
|
+
// For more information about locks, see [Lock
|
|
1166
|
+
// modes](https://cloud.google.com/spanner/docs/introspection/lock-statistics#explain-lock-modes).
|
|
1167
|
+
LOCK_HINT_SHARED = 1;
|
|
1168
|
+
|
|
1169
|
+
// Acquire exclusive locks.
|
|
1170
|
+
//
|
|
1171
|
+
// Requesting exclusive locks is beneficial if you observe high write
|
|
1172
|
+
// contention, which means you notice that multiple transactions are
|
|
1173
|
+
// concurrently trying to read and write to the same data, resulting in a
|
|
1174
|
+
// large number of aborts. This problem occurs when two transactions
|
|
1175
|
+
// initially acquire shared locks and then both try to upgrade to exclusive
|
|
1176
|
+
// locks at the same time. In this situation both transactions are waiting
|
|
1177
|
+
// for the other to give up their lock, resulting in a deadlocked situation.
|
|
1178
|
+
// Spanner is able to detect this occurring and force one of the
|
|
1179
|
+
// transactions to abort. However, this is a slow and expensive operation
|
|
1180
|
+
// and results in lower performance. In this case it makes sense to acquire
|
|
1181
|
+
// exclusive locks at the start of the transaction because then when
|
|
1182
|
+
// multiple transactions try to act on the same data, they automatically get
|
|
1183
|
+
// serialized. Each transaction waits its turn to acquire the lock and
|
|
1184
|
+
// avoids getting into deadlock situations.
|
|
1185
|
+
//
|
|
1186
|
+
// Because the exclusive lock hint is just a hint, it shouldn't be
|
|
1187
|
+
// considered equivalent to a mutex. In other words, you shouldn't use
|
|
1188
|
+
// Spanner exclusive locks as a mutual exclusion mechanism for the execution
|
|
1189
|
+
// of code outside of Spanner.
|
|
1190
|
+
//
|
|
1191
|
+
// **Note:** Request exclusive locks judiciously because they block others
|
|
1192
|
+
// from reading that data for the entire transaction, rather than just when
|
|
1193
|
+
// the writes are being performed. Unless you observe high write contention,
|
|
1194
|
+
// you should use the default of shared read locks so you don't prematurely
|
|
1195
|
+
// block other clients from reading the data that you're writing to.
|
|
1196
|
+
LOCK_HINT_EXCLUSIVE = 2;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// Required. The session in which the read should be performed.
|
|
1200
|
+
string session = 1 [
|
|
1201
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1202
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1203
|
+
];
|
|
1204
|
+
|
|
1205
|
+
// The transaction to use. If none is provided, the default is a
|
|
1206
|
+
// temporary read-only transaction with strong concurrency.
|
|
1207
|
+
TransactionSelector transaction = 2;
|
|
1208
|
+
|
|
1209
|
+
// Required. The name of the table in the database to be read.
|
|
1210
|
+
string table = 3 [(google.api.field_behavior) = REQUIRED];
|
|
1211
|
+
|
|
1212
|
+
// If non-empty, the name of an index on
|
|
1213
|
+
// [table][google.spanner.v1.ReadRequest.table]. This index is used instead of
|
|
1214
|
+
// the table primary key when interpreting
|
|
1215
|
+
// [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows.
|
|
1216
|
+
// See [key_set][google.spanner.v1.ReadRequest.key_set] for further
|
|
1217
|
+
// information.
|
|
1218
|
+
string index = 4;
|
|
1219
|
+
|
|
1220
|
+
// Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be
|
|
1221
|
+
// returned for each row matching this request.
|
|
1222
|
+
repeated string columns = 5 [(google.api.field_behavior) = REQUIRED];
|
|
1223
|
+
|
|
1224
|
+
// Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
|
1225
|
+
// primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to
|
|
1226
|
+
// be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present.
|
|
1227
|
+
// If [index][google.spanner.v1.ReadRequest.index] is present, then
|
|
1228
|
+
// [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys
|
|
1229
|
+
// in [index][google.spanner.v1.ReadRequest.index].
|
|
1230
|
+
//
|
|
1231
|
+
// If the [partition_token][google.spanner.v1.ReadRequest.partition_token]
|
|
1232
|
+
// field is empty, rows are yielded in table primary key order (if
|
|
1233
|
+
// [index][google.spanner.v1.ReadRequest.index] is empty) or index key order
|
|
1234
|
+
// (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the
|
|
1235
|
+
// [partition_token][google.spanner.v1.ReadRequest.partition_token] field
|
|
1236
|
+
// isn't empty, rows are yielded in an unspecified order.
|
|
1237
|
+
//
|
|
1238
|
+
// It isn't an error for the `key_set` to name rows that don't
|
|
1239
|
+
// exist in the database. Read yields nothing for nonexistent rows.
|
|
1240
|
+
KeySet key_set = 6 [(google.api.field_behavior) = REQUIRED];
|
|
1241
|
+
|
|
1242
|
+
// If greater than zero, only the first `limit` rows are yielded. If `limit`
|
|
1243
|
+
// is zero, the default is no limit. A limit can't be specified if
|
|
1244
|
+
// `partition_token` is set.
|
|
1245
|
+
int64 limit = 8;
|
|
1246
|
+
|
|
1247
|
+
// If this request is resuming a previously interrupted read,
|
|
1248
|
+
// `resume_token` should be copied from the last
|
|
1249
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
|
|
1250
|
+
// interruption. Doing this enables the new read to resume where the last read
|
|
1251
|
+
// left off. The rest of the request parameters must exactly match the request
|
|
1252
|
+
// that yielded this token.
|
|
1253
|
+
bytes resume_token = 9;
|
|
1254
|
+
|
|
1255
|
+
// If present, results are restricted to the specified partition
|
|
1256
|
+
// previously created using `PartitionRead`. There must be an exact
|
|
1257
|
+
// match for the values of fields common to this message and the
|
|
1258
|
+
// PartitionReadRequest message used to create this partition_token.
|
|
1259
|
+
bytes partition_token = 10;
|
|
1260
|
+
|
|
1261
|
+
// Common options for this request.
|
|
1262
|
+
RequestOptions request_options = 11;
|
|
1263
|
+
|
|
1264
|
+
// Directed read options for this request.
|
|
1265
|
+
DirectedReadOptions directed_read_options = 14;
|
|
1266
|
+
|
|
1267
|
+
// If this is for a partitioned read and this field is set to `true`, the
|
|
1268
|
+
// request is executed with Spanner Data Boost independent compute resources.
|
|
1269
|
+
//
|
|
1270
|
+
// If the field is set to `true` but the request doesn't set
|
|
1271
|
+
// `partition_token`, the API returns an `INVALID_ARGUMENT` error.
|
|
1272
|
+
bool data_boost_enabled = 15;
|
|
1273
|
+
|
|
1274
|
+
// Optional. Order for the returned rows.
|
|
1275
|
+
//
|
|
1276
|
+
// By default, Spanner returns result rows in primary key order except for
|
|
1277
|
+
// PartitionRead requests. For applications that don't require rows to be
|
|
1278
|
+
// returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
|
|
1279
|
+
// `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
|
|
1280
|
+
// resulting in lower latencies in certain cases (for example, bulk point
|
|
1281
|
+
// lookups).
|
|
1282
|
+
OrderBy order_by = 16 [(google.api.field_behavior) = OPTIONAL];
|
|
1283
|
+
|
|
1284
|
+
// Optional. Lock Hint for the request, it can only be used with read-write
|
|
1285
|
+
// transactions.
|
|
1286
|
+
LockHint lock_hint = 17 [(google.api.field_behavior) = OPTIONAL];
|
|
1287
|
+
|
|
1288
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1289
|
+
//
|
|
1290
|
+
// It gives the server hints that can be used to route the request
|
|
1291
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
1292
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
1293
|
+
// filled in with accurate values.
|
|
1294
|
+
RoutingHint routing_hint = 18 [(google.api.field_behavior) = OPTIONAL];
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
// The request for
|
|
1298
|
+
// [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
|
|
1299
|
+
message BeginTransactionRequest {
|
|
1300
|
+
// Required. The session in which the transaction runs.
|
|
1301
|
+
string session = 1 [
|
|
1302
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1303
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1304
|
+
];
|
|
1305
|
+
|
|
1306
|
+
// Required. Options for the new transaction.
|
|
1307
|
+
TransactionOptions options = 2 [(google.api.field_behavior) = REQUIRED];
|
|
1308
|
+
|
|
1309
|
+
// Common options for this request.
|
|
1310
|
+
// Priority is ignored for this request. Setting the priority in this
|
|
1311
|
+
// `request_options` struct doesn't do anything. To set the priority for a
|
|
1312
|
+
// transaction, set it on the reads and writes that are part of this
|
|
1313
|
+
// transaction instead.
|
|
1314
|
+
RequestOptions request_options = 3;
|
|
1315
|
+
|
|
1316
|
+
// Optional. Required for read-write transactions on a multiplexed session
|
|
1317
|
+
// that commit mutations but don't perform any reads or queries. You must
|
|
1318
|
+
// randomly select one of the mutations from the mutation set and send it as a
|
|
1319
|
+
// part of this request.
|
|
1320
|
+
Mutation mutation_key = 4 [(google.api.field_behavior) = OPTIONAL];
|
|
1321
|
+
|
|
1322
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1323
|
+
//
|
|
1324
|
+
// It gives the server hints that can be used to route the request
|
|
1325
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
1326
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
1327
|
+
// filled in with accurate values.
|
|
1328
|
+
RoutingHint routing_hint = 5 [(google.api.field_behavior) = OPTIONAL];
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
// The request for [Commit][google.spanner.v1.Spanner.Commit].
|
|
1332
|
+
message CommitRequest {
|
|
1333
|
+
// Required. The session in which the transaction to be committed is running.
|
|
1334
|
+
string session = 1 [
|
|
1335
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1336
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1337
|
+
];
|
|
1338
|
+
|
|
1339
|
+
// Required. The transaction in which to commit.
|
|
1340
|
+
oneof transaction {
|
|
1341
|
+
// Commit a previously-started transaction.
|
|
1342
|
+
bytes transaction_id = 2;
|
|
1343
|
+
|
|
1344
|
+
// Execute mutations in a temporary transaction. Note that unlike
|
|
1345
|
+
// commit of a previously-started transaction, commit with a
|
|
1346
|
+
// temporary transaction is non-idempotent. That is, if the
|
|
1347
|
+
// `CommitRequest` is sent to Cloud Spanner more than once (for
|
|
1348
|
+
// instance, due to retries in the application, or in the
|
|
1349
|
+
// transport library), it's possible that the mutations are
|
|
1350
|
+
// executed more than once. If this is undesirable, use
|
|
1351
|
+
// [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and
|
|
1352
|
+
// [Commit][google.spanner.v1.Spanner.Commit] instead.
|
|
1353
|
+
TransactionOptions single_use_transaction = 3;
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// The mutations to be executed when this transaction commits. All
|
|
1357
|
+
// mutations are applied atomically, in the order they appear in
|
|
1358
|
+
// this list.
|
|
1359
|
+
repeated Mutation mutations = 4;
|
|
1360
|
+
|
|
1361
|
+
// If `true`, then statistics related to the transaction is included in
|
|
1362
|
+
// the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats].
|
|
1363
|
+
// Default value is `false`.
|
|
1364
|
+
bool return_commit_stats = 5;
|
|
1365
|
+
|
|
1366
|
+
// Optional. The amount of latency this request is configured to incur in
|
|
1367
|
+
// order to improve throughput. If this field isn't set, Spanner assumes
|
|
1368
|
+
// requests are relatively latency sensitive and automatically determines an
|
|
1369
|
+
// appropriate delay time. You can specify a commit delay value between 0 and
|
|
1370
|
+
// 500 ms.
|
|
1371
|
+
google.protobuf.Duration max_commit_delay = 8
|
|
1372
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
1373
|
+
|
|
1374
|
+
// Common options for this request.
|
|
1375
|
+
RequestOptions request_options = 6;
|
|
1376
|
+
|
|
1377
|
+
// Optional. If the read-write transaction was executed on a multiplexed
|
|
1378
|
+
// session, then you must include the precommit token with the highest
|
|
1379
|
+
// sequence number received in this transaction attempt. Failing to do so
|
|
1380
|
+
// results in a `FailedPrecondition` error.
|
|
1381
|
+
MultiplexedSessionPrecommitToken precommit_token = 9
|
|
1382
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
1383
|
+
|
|
1384
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1385
|
+
//
|
|
1386
|
+
// It gives the server hints that can be used to route the request
|
|
1387
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
1388
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
1389
|
+
// filled in with accurate values.
|
|
1390
|
+
RoutingHint routing_hint = 10 [(google.api.field_behavior) = OPTIONAL];
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// The request for [Rollback][google.spanner.v1.Spanner.Rollback].
|
|
1394
|
+
message RollbackRequest {
|
|
1395
|
+
// Required. The session in which the transaction to roll back is running.
|
|
1396
|
+
string session = 1 [
|
|
1397
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1398
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1399
|
+
];
|
|
1400
|
+
|
|
1401
|
+
// Required. The transaction to roll back.
|
|
1402
|
+
bytes transaction_id = 2 [(google.api.field_behavior) = REQUIRED];
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
// The request for [BatchWrite][google.spanner.v1.Spanner.BatchWrite].
|
|
1406
|
+
message BatchWriteRequest {
|
|
1407
|
+
// A group of mutations to be committed together. Related mutations should be
|
|
1408
|
+
// placed in a group. For example, two mutations inserting rows with the same
|
|
1409
|
+
// primary key prefix in both parent and child tables are related.
|
|
1410
|
+
message MutationGroup {
|
|
1411
|
+
// Required. The mutations in this group.
|
|
1412
|
+
repeated Mutation mutations = 1 [(google.api.field_behavior) = REQUIRED];
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// Required. The session in which the batch request is to be run.
|
|
1416
|
+
string session = 1 [
|
|
1417
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1418
|
+
(google.api.resource_reference) = { type: "spanner.googleapis.com/Session" }
|
|
1419
|
+
];
|
|
1420
|
+
|
|
1421
|
+
// Common options for this request.
|
|
1422
|
+
RequestOptions request_options = 3;
|
|
1423
|
+
|
|
1424
|
+
// Required. The groups of mutations to be applied.
|
|
1425
|
+
repeated MutationGroup mutation_groups = 4
|
|
1426
|
+
[(google.api.field_behavior) = REQUIRED];
|
|
1427
|
+
|
|
1428
|
+
// Optional. If you don't set the `exclude_txn_from_change_streams` option or
|
|
1429
|
+
// if it's set to `false`, then any change streams monitoring columns modified
|
|
1430
|
+
// by transactions will capture the updates made within that transaction.
|
|
1431
|
+
bool exclude_txn_from_change_streams = 5
|
|
1432
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
// The result of applying a batch of mutations.
|
|
1436
|
+
message BatchWriteResponse {
|
|
1437
|
+
// The mutation groups applied in this batch. The values index into the
|
|
1438
|
+
// `mutation_groups` field in the corresponding `BatchWriteRequest`.
|
|
1439
|
+
repeated int32 indexes = 1;
|
|
1440
|
+
|
|
1441
|
+
// An `OK` status indicates success. Any other status indicates a failure.
|
|
1442
|
+
google.rpc.Status status = 2;
|
|
1443
|
+
|
|
1444
|
+
// The commit timestamp of the transaction that applied this batch.
|
|
1445
|
+
// Present if status is OK and the mutation groups were applied, absent
|
|
1446
|
+
// otherwise.
|
|
1447
|
+
//
|
|
1448
|
+
// For mutation groups with conditions, a status=OK and missing
|
|
1449
|
+
// commit_timestamp means that the mutation groups were not applied due to the
|
|
1450
|
+
// condition not being satisfied after evaluation.
|
|
1451
|
+
google.protobuf.Timestamp commit_timestamp = 3;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
// The request for
|
|
1455
|
+
// [FetchCacheUpdate][google.spanner.v1.Spanner.FetchCacheUpdate].
|
|
1456
|
+
message FetchCacheUpdateRequest {
|
|
1457
|
+
// Required. The database for which to retrieve the cache update.
|
|
1458
|
+
string database = 1 [
|
|
1459
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1460
|
+
(google.api.resource_reference) = {
|
|
1461
|
+
type: "spanner.googleapis.com/Database"
|
|
1462
|
+
}
|
|
1463
|
+
];
|
|
1464
|
+
|
|
1465
|
+
// Optional. The maximum number of key recipes to return in the response.
|
|
1466
|
+
// If not set, a default limit of 100 will be used.
|
|
1467
|
+
int32 max_recipe_count = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
1468
|
+
|
|
1469
|
+
// Optional. The maximum number of ranges to return in the response.
|
|
1470
|
+
// If not set, a default limit of 10000 will be used.
|
|
1471
|
+
int32 max_range_count = 3 [(google.api.field_behavior) = OPTIONAL];
|
|
1472
|
+
}
|