google-cloud-spanner 1.14.0 → 1.15.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/google-cloud-spanner.rb +13 -0
- data/lib/google/cloud/spanner.rb +2 -1
- data/lib/google/cloud/spanner/admin/database.rb +3 -2
- data/lib/google/cloud/spanner/admin/database/v1.rb +3 -2
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +742 -20
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +40 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +222 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +113 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +325 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +197 -30
- data/lib/google/cloud/spanner/admin/instance.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +6 -13
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +8 -5
- data/lib/google/cloud/spanner/batch_client.rb +5 -3
- data/lib/google/cloud/spanner/batch_snapshot.rb +43 -8
- data/lib/google/cloud/spanner/client.rb +57 -8
- data/lib/google/cloud/spanner/project.rb +31 -6
- data/lib/google/cloud/spanner/results.rb +4 -2
- data/lib/google/cloud/spanner/service.rb +3 -1
- data/lib/google/cloud/spanner/session.rb +37 -6
- data/lib/google/cloud/spanner/snapshot.rb +26 -3
- data/lib/google/cloud/spanner/transaction.rb +49 -5
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +8 -1
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +91 -102
- data/lib/google/cloud/spanner/v1/spanner_client.rb +112 -136
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/spanner/admin/database/v1/backup_pb.rb +98 -0
- data/lib/google/spanner/admin/database/v1/common_pb.rb +28 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +53 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +82 -12
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +1 -2
- data/lib/google/spanner/v1/spanner_pb.rb +5 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +31 -40
- metadata +7 -2
@@ -118,6 +118,14 @@ module Google
|
|
118
118
|
# specified using a {Fields} object.
|
119
119
|
#
|
120
120
|
# Types are optional.
|
121
|
+
# @param [Hash] query_options A hash of values to specify the custom
|
122
|
+
# query options for executing SQL query. Query options are optional.
|
123
|
+
# The following settings can be provided:
|
124
|
+
#
|
125
|
+
# * `:optimizer_version` (String) The version of optimizer to use.
|
126
|
+
# Empty to use database default. "latest" to use the latest
|
127
|
+
# available optimizer version.
|
128
|
+
#
|
121
129
|
# @return [Google::Cloud::Spanner::Results] The results of the query
|
122
130
|
# execution.
|
123
131
|
#
|
@@ -220,13 +228,28 @@ module Google
|
|
220
228
|
# end
|
221
229
|
# end
|
222
230
|
#
|
223
|
-
|
231
|
+
# @example Query using query options:
|
232
|
+
# require "google/cloud/spanner"
|
233
|
+
#
|
234
|
+
# spanner = Google::Cloud::Spanner.new
|
235
|
+
# db = spanner.client "my-instance", "my-database"
|
236
|
+
#
|
237
|
+
# db.snapshot do |snp|
|
238
|
+
# results = snp.execute_query \
|
239
|
+
# "SELECT * FROM users", query_options: { optimizer_version: "1" }
|
240
|
+
#
|
241
|
+
# results.rows.each do |row|
|
242
|
+
# puts "User #{row[:id]} is #{row[:name]}"
|
243
|
+
# end
|
244
|
+
# end
|
245
|
+
#
|
246
|
+
def execute_query sql, params: nil, types: nil, query_options: nil
|
224
247
|
ensure_session!
|
225
248
|
|
226
249
|
params, types = Convert.to_input_params_and_types params, types
|
227
|
-
|
228
250
|
session.execute_query sql, params: params, types: types,
|
229
|
-
transaction: tx_selector
|
251
|
+
transaction: tx_selector,
|
252
|
+
query_options: query_options
|
230
253
|
end
|
231
254
|
alias execute execute_query
|
232
255
|
alias query execute_query
|
@@ -148,6 +148,14 @@ module Google
|
|
148
148
|
# specified using a {Fields} object.
|
149
149
|
#
|
150
150
|
# Types are optional.
|
151
|
+
# @param [Hash] query_options A hash of values to specify the custom
|
152
|
+
# query options for executing SQL query. Query options are optional.
|
153
|
+
# The following settings can be provided:
|
154
|
+
#
|
155
|
+
# * `:optimizer_version` (String) The version of optimizer to use.
|
156
|
+
# Empty to use database default. "latest" to use the latest
|
157
|
+
# available optimizer version.
|
158
|
+
#
|
151
159
|
# @return [Google::Cloud::Spanner::Results] The results of the query
|
152
160
|
# execution.
|
153
161
|
#
|
@@ -251,15 +259,30 @@ module Google
|
|
251
259
|
# end
|
252
260
|
# end
|
253
261
|
#
|
254
|
-
|
262
|
+
# @example Query using query options:
|
263
|
+
# require "google/cloud/spanner"
|
264
|
+
#
|
265
|
+
# spanner = Google::Cloud::Spanner.new
|
266
|
+
# db = spanner.client "my-instance", "my-database"
|
267
|
+
#
|
268
|
+
# db.transaction do |tx|
|
269
|
+
# results = tx.execute_query \
|
270
|
+
# "SELECT * FROM users", query_options: { optimizer_version: "1" }
|
271
|
+
#
|
272
|
+
# results.rows.each do |row|
|
273
|
+
# puts "User #{row[:id]} is #{row[:name]}"
|
274
|
+
# end
|
275
|
+
# end
|
276
|
+
#
|
277
|
+
def execute_query sql, params: nil, types: nil, query_options: nil
|
255
278
|
ensure_session!
|
256
279
|
|
257
280
|
@seqno += 1
|
258
281
|
|
259
282
|
params, types = Convert.to_input_params_and_types params, types
|
260
|
-
|
261
283
|
session.execute_query sql, params: params, types: types,
|
262
|
-
transaction: tx_selector, seqno: @seqno
|
284
|
+
transaction: tx_selector, seqno: @seqno,
|
285
|
+
query_options: query_options
|
263
286
|
end
|
264
287
|
alias execute execute_query
|
265
288
|
alias query execute_query
|
@@ -322,6 +345,13 @@ module Google
|
|
322
345
|
# `[:INT64]`.
|
323
346
|
# * {Fields} - Nested Structs are specified by providing a Fields
|
324
347
|
# object.
|
348
|
+
# @param [Hash] query_options A hash of values to specify the custom
|
349
|
+
# query options for executing SQL query. Query options are optional.
|
350
|
+
# The following settings can be provided:
|
351
|
+
#
|
352
|
+
# * `:optimizer_version` (String) The version of optimizer to use.
|
353
|
+
# Empty to use database default. "latest" to use the latest
|
354
|
+
# available optimizer version.
|
325
355
|
#
|
326
356
|
# @return [Integer] The exact number of rows that were modified.
|
327
357
|
#
|
@@ -350,8 +380,22 @@ module Google
|
|
350
380
|
# )
|
351
381
|
# end
|
352
382
|
#
|
353
|
-
|
354
|
-
|
383
|
+
# @example Update using query options
|
384
|
+
# require "google/cloud/spanner"
|
385
|
+
#
|
386
|
+
# spanner = Google::Cloud::Spanner.new
|
387
|
+
# db = spanner.client "my-instance", "my-database"
|
388
|
+
#
|
389
|
+
# db.transaction do |tx|
|
390
|
+
# row_count = tx.execute_update(
|
391
|
+
# "UPDATE users SET name = 'Charlie' WHERE id = 1",
|
392
|
+
# query_options: { optimizer_version: "1" }
|
393
|
+
# )
|
394
|
+
# end
|
395
|
+
#
|
396
|
+
def execute_update sql, params: nil, types: nil, query_options: nil
|
397
|
+
results = execute_query sql, params: params, types: types,
|
398
|
+
query_options: query_options
|
355
399
|
# Stream all PartialResultSet to get ResultSetStats
|
356
400
|
results.rows.to_a
|
357
401
|
# Raise an error if there is not a row count returned
|
@@ -32,6 +32,10 @@ module Google
|
|
32
32
|
# Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, then
|
33
33
|
# its column values are overwritten with the ones provided. Any
|
34
34
|
# column values not explicitly written are preserved.
|
35
|
+
#
|
36
|
+
# When using {Google::Spanner::V1::Mutation#insert_or_update insert_or_update}, just as when using {Google::Spanner::V1::Mutation#insert insert}, all `NOT
|
37
|
+
# NULL` columns in the table must be given a value. This holds true
|
38
|
+
# even when the row already exists and will therefore actually be updated.
|
35
39
|
# @!attribute [rw] replace
|
36
40
|
# @return [Google::Spanner::V1::Mutation::Write]
|
37
41
|
# Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, it is
|
@@ -78,7 +82,10 @@ module Google
|
|
78
82
|
# Required. The table whose rows will be deleted.
|
79
83
|
# @!attribute [rw] key_set
|
80
84
|
# @return [Google::Spanner::V1::KeySet]
|
81
|
-
# Required. The primary keys of the rows within {Google::Spanner::V1::Mutation::Delete#table table} to delete.
|
85
|
+
# Required. The primary keys of the rows within {Google::Spanner::V1::Mutation::Delete#table table} to delete. The
|
86
|
+
# primary keys must be specified in the order in which they appear in the
|
87
|
+
# `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
|
88
|
+
# statement used to create the table).
|
82
89
|
# Delete is idempotent. The transaction will succeed even if some or all
|
83
90
|
# rows do not exist.
|
84
91
|
class Delete; end
|
@@ -25,8 +25,7 @@ module Google
|
|
25
25
|
# The session to create.
|
26
26
|
class CreateSessionRequest; end
|
27
27
|
|
28
|
-
# The request for
|
29
|
-
# {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
|
28
|
+
# The request for {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
|
30
29
|
# @!attribute [rw] database
|
31
30
|
# @return [String]
|
32
31
|
# Required. The database in which the new sessions are created.
|
@@ -39,12 +38,10 @@ module Google
|
|
39
38
|
# The API may return fewer than the requested number of sessions. If a
|
40
39
|
# specific number of sessions are desired, the client can make additional
|
41
40
|
# calls to BatchCreateSessions (adjusting
|
42
|
-
# {Google::Spanner::V1::BatchCreateSessionsRequest#session_count session_count}
|
43
|
-
# as necessary).
|
41
|
+
# {Google::Spanner::V1::BatchCreateSessionsRequest#session_count session_count} as necessary).
|
44
42
|
class BatchCreateSessionsRequest; end
|
45
43
|
|
46
|
-
# The response for
|
47
|
-
# {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
|
44
|
+
# The response for {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
|
48
45
|
# @!attribute [rw] session
|
49
46
|
# @return [Array<Google::Spanner::V1::Session>]
|
50
47
|
# The freshly created sessions.
|
@@ -92,8 +89,7 @@ module Google
|
|
92
89
|
# @!attribute [rw] page_token
|
93
90
|
# @return [String]
|
94
91
|
# If non-empty, `page_token` should contain a
|
95
|
-
# {Google::Spanner::V1::ListSessionsResponse#next_page_token next_page_token}
|
96
|
-
# from a previous
|
92
|
+
# {Google::Spanner::V1::ListSessionsResponse#next_page_token next_page_token} from a previous
|
97
93
|
# {Google::Spanner::V1::ListSessionsResponse ListSessionsResponse}.
|
98
94
|
# @!attribute [rw] filter
|
99
95
|
# @return [String]
|
@@ -116,8 +112,8 @@ module Google
|
|
116
112
|
# @!attribute [rw] next_page_token
|
117
113
|
# @return [String]
|
118
114
|
# `next_page_token` can be sent in a subsequent
|
119
|
-
# {Google::Spanner::V1::Spanner::ListSessions ListSessions} call to fetch more
|
120
|
-
#
|
115
|
+
# {Google::Spanner::V1::Spanner::ListSessions ListSessions} call to fetch more of the matching
|
116
|
+
# sessions.
|
121
117
|
class ListSessionsResponse; end
|
122
118
|
|
123
119
|
# The request for {Google::Spanner::V1::Spanner::DeleteSession DeleteSession}.
|
@@ -164,8 +160,7 @@ module Google
|
|
164
160
|
# @return [Hash{String => Google::Spanner::V1::Type}]
|
165
161
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
166
162
|
# from a JSON value. For example, values of type `BYTES` and values
|
167
|
-
# of type `STRING` both appear in
|
168
|
-
# {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
|
163
|
+
# of type `STRING` both appear in {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
|
169
164
|
#
|
170
165
|
# In these cases, `param_types` can be used to specify the exact
|
171
166
|
# SQL type for some or all of the SQL statement parameters. See the
|
@@ -175,18 +170,15 @@ module Google
|
|
175
170
|
# @return [String]
|
176
171
|
# If this request is resuming a previously interrupted SQL statement
|
177
172
|
# execution, `resume_token` should be copied from the last
|
178
|
-
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
173
|
+
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
174
|
+
# enables the new SQL statement execution to resume where the last one left
|
175
|
+
# off. The rest of the request parameters must exactly match the
|
176
|
+
# request that yielded this token.
|
182
177
|
# @!attribute [rw] query_mode
|
183
178
|
# @return [Google::Spanner::V1::ExecuteSqlRequest::QueryMode]
|
184
179
|
# Used to control the amount of debugging information returned in
|
185
|
-
# {Google::Spanner::V1::ResultSetStats ResultSetStats}. If
|
186
|
-
# {Google::Spanner::V1::ExecuteSqlRequest
|
187
|
-
# set, {Google::Spanner::V1::ExecuteSqlRequest#query_mode query_mode} can only
|
188
|
-
# be set to
|
189
|
-
# {Google::Spanner::V1::ExecuteSqlRequest::QueryMode::NORMAL QueryMode::NORMAL}.
|
180
|
+
# {Google::Spanner::V1::ResultSetStats ResultSetStats}. If {Google::Spanner::V1::ExecuteSqlRequest#partition_token partition_token} is set, {Google::Spanner::V1::ExecuteSqlRequest#query_mode query_mode} can only
|
181
|
+
# be set to {Google::Spanner::V1::ExecuteSqlRequest::QueryMode::NORMAL QueryMode::NORMAL}.
|
190
182
|
# @!attribute [rw] partition_token
|
191
183
|
# @return [String]
|
192
184
|
# If present, results will be restricted to the specified partition
|
@@ -205,7 +197,31 @@ module Google
|
|
205
197
|
# handled requests will yield the same response as the first execution.
|
206
198
|
#
|
207
199
|
# Required for DML statements. Ignored for queries.
|
200
|
+
# @!attribute [rw] query_options
|
201
|
+
# @return [Google::Spanner::V1::ExecuteSqlRequest::QueryOptions]
|
202
|
+
# Query optimizer configuration to use for the given query.
|
208
203
|
class ExecuteSqlRequest
|
204
|
+
# Query optimizer configuration.
|
205
|
+
# @!attribute [rw] optimizer_version
|
206
|
+
# @return [String]
|
207
|
+
# An option to control the selection of optimizer version.
|
208
|
+
#
|
209
|
+
# This parameter allows individual queries to pick different query
|
210
|
+
# optimizer versions.
|
211
|
+
#
|
212
|
+
# Specifying "latest" as a value instructs Cloud Spanner to use the
|
213
|
+
# latest supported query optimizer version. If not specified, Cloud Spanner
|
214
|
+
# uses optimizer version set at the database level options. Any other
|
215
|
+
# positive integer (from the list of supported optimizer versions)
|
216
|
+
# overrides the default optimizer version for query execution.
|
217
|
+
# The list of supported optimizer versions can be queried from
|
218
|
+
# SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
|
219
|
+
# with an invalid optimizer version will fail with a syntax error
|
220
|
+
# (`INVALID_ARGUMENT`) status.
|
221
|
+
#
|
222
|
+
# The `optimizer_version` statement hint has precedence over this setting.
|
223
|
+
class QueryOptions; end
|
224
|
+
|
209
225
|
# Mode in which the statement must be processed.
|
210
226
|
module QueryMode
|
211
227
|
# The default mode. Only the statement results are returned.
|
@@ -234,17 +250,17 @@ module Google
|
|
234
250
|
# transaction.
|
235
251
|
# @!attribute [rw] statements
|
236
252
|
# @return [Array<Google::Spanner::V1::ExecuteBatchDmlRequest::Statement>]
|
237
|
-
# Required. The list of statements to execute in this batch. Statements are
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
253
|
+
# Required. The list of statements to execute in this batch. Statements are executed
|
254
|
+
# serially, such that the effects of statement `i` are visible to statement
|
255
|
+
# `i+1`. Each statement must be a DML statement. Execution stops at the
|
256
|
+
# first failed statement; the remaining statements are not executed.
|
241
257
|
#
|
242
258
|
# Callers must provide at least one statement.
|
243
259
|
# @!attribute [rw] seqno
|
244
260
|
# @return [Integer]
|
245
|
-
# Required. A per-transaction sequence number used to identify this request.
|
246
|
-
#
|
247
|
-
#
|
261
|
+
# Required. A per-transaction sequence number used to identify this request. This field
|
262
|
+
# makes each request idempotent such that if the request is received multiple
|
263
|
+
# times, at most one will succeed.
|
248
264
|
#
|
249
265
|
# The sequence number must be monotonically increasing within the
|
250
266
|
# transaction. If a request arrives for the first time with an out-of-order
|
@@ -273,9 +289,7 @@ module Google
|
|
273
289
|
# @return [Hash{String => Google::Spanner::V1::Type}]
|
274
290
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
275
291
|
# from a JSON value. For example, values of type `BYTES` and values
|
276
|
-
# of type `STRING` both appear in
|
277
|
-
# {Google::Spanner::V1::ExecuteBatchDmlRequest::Statement#params params} as
|
278
|
-
# JSON strings.
|
292
|
+
# of type `STRING` both appear in {Google::Spanner::V1::ExecuteBatchDmlRequest::Statement#params params} as JSON strings.
|
279
293
|
#
|
280
294
|
# In these cases, `param_types` can be used to specify the exact
|
281
295
|
# SQL type for some or all of the SQL statement parameters. See the
|
@@ -284,48 +298,39 @@ module Google
|
|
284
298
|
class Statement; end
|
285
299
|
end
|
286
300
|
|
287
|
-
# The response for
|
288
|
-
# {Google::Spanner::V1::
|
289
|
-
#
|
290
|
-
#
|
291
|
-
# in the request. If a statement fails, the status in the response body
|
292
|
-
# identifies the cause of the failure.
|
301
|
+
# The response for {Google::Spanner::V1::Spanner::ExecuteBatchDml ExecuteBatchDml}. Contains a list
|
302
|
+
# of {Google::Spanner::V1::ResultSet ResultSet} messages, one for each DML statement that has successfully
|
303
|
+
# executed, in the same order as the statements in the request. If a statement
|
304
|
+
# fails, the status in the response body identifies the cause of the failure.
|
293
305
|
#
|
294
306
|
# To check for DML statements that failed, use the following approach:
|
295
307
|
#
|
296
|
-
# 1. Check the status in the response message. The
|
297
|
-
# {Google::Rpc::Code} enum
|
308
|
+
# 1. Check the status in the response message. The {Google::Rpc::Code} enum
|
298
309
|
# value `OK` indicates that all statements were executed successfully.
|
299
310
|
# 2. If the status was not `OK`, check the number of result sets in the
|
300
|
-
# response. If the response contains `N`
|
301
|
-
#
|
302
|
-
# the request failed.
|
311
|
+
# response. If the response contains `N` {Google::Spanner::V1::ResultSet ResultSet} messages, then
|
312
|
+
# statement `N+1` in the request failed.
|
303
313
|
#
|
304
314
|
# Example 1:
|
305
315
|
#
|
306
316
|
# * Request: 5 DML statements, all executed successfully.
|
307
|
-
# * Response: 5 {Google::Spanner::V1::ResultSet ResultSet} messages, with the
|
308
|
-
# status `OK`.
|
317
|
+
# * Response: 5 {Google::Spanner::V1::ResultSet ResultSet} messages, with the status `OK`.
|
309
318
|
#
|
310
319
|
# Example 2:
|
311
320
|
#
|
312
321
|
# * Request: 5 DML statements. The third statement has a syntax error.
|
313
|
-
# * Response: 2 {Google::Spanner::V1::ResultSet ResultSet} messages, and a syntax
|
314
|
-
#
|
315
|
-
#
|
316
|
-
# indicates that the third statement failed, and the fourth and fifth
|
317
|
-
# statements were not executed.
|
322
|
+
# * Response: 2 {Google::Spanner::V1::ResultSet ResultSet} messages, and a syntax error (`INVALID_ARGUMENT`)
|
323
|
+
# status. The number of {Google::Spanner::V1::ResultSet ResultSet} messages indicates that the third
|
324
|
+
# statement failed, and the fourth and fifth statements were not executed.
|
318
325
|
# @!attribute [rw] result_sets
|
319
326
|
# @return [Array<Google::Spanner::V1::ResultSet>]
|
320
|
-
# One {Google::Spanner::V1::ResultSet ResultSet} for each statement in the
|
321
|
-
#
|
322
|
-
#
|
323
|
-
# rows
|
324
|
-
#
|
325
|
-
#
|
326
|
-
#
|
327
|
-
# Only the first {Google::Spanner::V1::ResultSet ResultSet} in the response
|
328
|
-
# contains valid {Google::Spanner::V1::ResultSetMetadata ResultSetMetadata}.
|
327
|
+
# One {Google::Spanner::V1::ResultSet ResultSet} for each statement in the request that ran successfully,
|
328
|
+
# in the same order as the statements in the request. Each {Google::Spanner::V1::ResultSet ResultSet} does
|
329
|
+
# not contain any rows. The {Google::Spanner::V1::ResultSetStats ResultSetStats} in each {Google::Spanner::V1::ResultSet ResultSet} contain
|
330
|
+
# the number of rows modified by the statement.
|
331
|
+
#
|
332
|
+
# Only the first {Google::Spanner::V1::ResultSet ResultSet} in the response contains valid
|
333
|
+
# {Google::Spanner::V1::ResultSetMetadata ResultSetMetadata}.
|
329
334
|
# @!attribute [rw] status
|
330
335
|
# @return [Google::Rpc::Status]
|
331
336
|
# If all DML statements are executed successfully, the status is `OK`.
|
@@ -364,16 +369,15 @@ module Google
|
|
364
369
|
# transactions are not.
|
365
370
|
# @!attribute [rw] sql
|
366
371
|
# @return [String]
|
367
|
-
# Required. The query request to generate partitions for. The request will
|
368
|
-
#
|
372
|
+
# Required. The query request to generate partitions for. The request will fail if
|
373
|
+
# the query is not root partitionable. The query plan of a root
|
369
374
|
# partitionable query has a single distributed union operator. A distributed
|
370
375
|
# union operator conceptually divides one or more tables into multiple
|
371
376
|
# splits, remotely evaluates a subquery independently on each split, and
|
372
377
|
# then unions all results.
|
373
378
|
#
|
374
379
|
# This must not contain DML commands, such as INSERT, UPDATE, or
|
375
|
-
# DELETE. Use
|
376
|
-
# {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql} with a
|
380
|
+
# DELETE. Use {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql} with a
|
377
381
|
# PartitionedDml transaction for large, partition-friendly DML operations.
|
378
382
|
# @!attribute [rw] params
|
379
383
|
# @return [Google::Protobuf::Struct]
|
@@ -393,8 +397,7 @@ module Google
|
|
393
397
|
# @return [Hash{String => Google::Spanner::V1::Type}]
|
394
398
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
395
399
|
# from a JSON value. For example, values of type `BYTES` and values
|
396
|
-
# of type `STRING` both appear in
|
397
|
-
# {Google::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
|
400
|
+
# of type `STRING` both appear in {Google::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
|
398
401
|
#
|
399
402
|
# In these cases, `param_types` can be used to specify the exact
|
400
403
|
# SQL type for some or all of the SQL query parameters. See the
|
@@ -418,24 +421,18 @@ module Google
|
|
418
421
|
# Required. The name of the table in the database to be read.
|
419
422
|
# @!attribute [rw] index
|
420
423
|
# @return [String]
|
421
|
-
# If non-empty, the name of an index on
|
422
|
-
# {Google::Spanner::V1::PartitionReadRequest#
|
423
|
-
#
|
424
|
-
# {Google::Spanner::V1::PartitionReadRequest#key_set key_set} and sorting
|
425
|
-
# result rows. See {Google::Spanner::V1::PartitionReadRequest#key_set key_set}
|
426
|
-
# for further information.
|
424
|
+
# If non-empty, the name of an index on {Google::Spanner::V1::PartitionReadRequest#table table}. This index is
|
425
|
+
# used instead of the table primary key when interpreting {Google::Spanner::V1::PartitionReadRequest#key_set key_set}
|
426
|
+
# and sorting result rows. See {Google::Spanner::V1::PartitionReadRequest#key_set key_set} for further information.
|
427
427
|
# @!attribute [rw] columns
|
428
428
|
# @return [Array<String>]
|
429
|
-
# The columns of {Google::Spanner::V1::PartitionReadRequest#table table} to be
|
430
|
-
#
|
429
|
+
# The columns of {Google::Spanner::V1::PartitionReadRequest#table table} to be returned for each row matching
|
430
|
+
# this request.
|
431
431
|
# @!attribute [rw] key_set
|
432
432
|
# @return [Google::Spanner::V1::KeySet]
|
433
433
|
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
434
|
-
# primary keys of the rows in
|
435
|
-
# {Google::Spanner::V1::PartitionReadRequest#
|
436
|
-
# {Google::Spanner::V1::PartitionReadRequest#index index} is present. If
|
437
|
-
# {Google::Spanner::V1::PartitionReadRequest#index index} is present, then
|
438
|
-
# {Google::Spanner::V1::PartitionReadRequest#key_set key_set} instead names
|
434
|
+
# primary keys of the rows in {Google::Spanner::V1::PartitionReadRequest#table table} to be yielded, unless {Google::Spanner::V1::PartitionReadRequest#index index}
|
435
|
+
# is present. If {Google::Spanner::V1::PartitionReadRequest#index index} is present, then {Google::Spanner::V1::PartitionReadRequest#key_set key_set} instead names
|
439
436
|
# index keys in {Google::Spanner::V1::PartitionReadRequest#index index}.
|
440
437
|
#
|
441
438
|
# It is not an error for the `key_set` to name rows that do not
|
@@ -478,31 +475,24 @@ module Google
|
|
478
475
|
# Required. The name of the table in the database to be read.
|
479
476
|
# @!attribute [rw] index
|
480
477
|
# @return [String]
|
481
|
-
# If non-empty, the name of an index on
|
482
|
-
# {Google::Spanner::V1::ReadRequest#
|
483
|
-
#
|
484
|
-
# {Google::Spanner::V1::ReadRequest#key_set key_set} and sorting result rows.
|
485
|
-
# See {Google::Spanner::V1::ReadRequest#key_set key_set} for further
|
486
|
-
# information.
|
478
|
+
# If non-empty, the name of an index on {Google::Spanner::V1::ReadRequest#table table}. This index is
|
479
|
+
# used instead of the table primary key when interpreting {Google::Spanner::V1::ReadRequest#key_set key_set}
|
480
|
+
# and sorting result rows. See {Google::Spanner::V1::ReadRequest#key_set key_set} for further information.
|
487
481
|
# @!attribute [rw] columns
|
488
482
|
# @return [Array<String>]
|
489
|
-
# Required. The columns of {Google::Spanner::V1::ReadRequest#table table} to be
|
490
|
-
#
|
483
|
+
# Required. The columns of {Google::Spanner::V1::ReadRequest#table table} to be returned for each row matching
|
484
|
+
# this request.
|
491
485
|
# @!attribute [rw] key_set
|
492
486
|
# @return [Google::Spanner::V1::KeySet]
|
493
487
|
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
494
|
-
# primary keys of the rows in {Google::Spanner::V1::ReadRequest#table table} to
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
#
|
500
|
-
# If the {Google::Spanner::V1::ReadRequest#partition_token partition_token}
|
501
|
-
#
|
502
|
-
# {Google::Spanner::V1::ReadRequest#index index} is empty) or index key order
|
503
|
-
# (if {Google::Spanner::V1::ReadRequest#index index} is non-empty). If the
|
504
|
-
# {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is
|
505
|
-
# not empty, rows will be yielded in an unspecified order.
|
488
|
+
# primary keys of the rows in {Google::Spanner::V1::ReadRequest#table table} to be yielded, unless {Google::Spanner::V1::ReadRequest#index index}
|
489
|
+
# is present. If {Google::Spanner::V1::ReadRequest#index index} is present, then {Google::Spanner::V1::ReadRequest#key_set key_set} instead names
|
490
|
+
# index keys in {Google::Spanner::V1::ReadRequest#index index}.
|
491
|
+
#
|
492
|
+
# If the {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is empty, rows are yielded
|
493
|
+
# in table primary key order (if {Google::Spanner::V1::ReadRequest#index index} is empty) or index key order
|
494
|
+
# (if {Google::Spanner::V1::ReadRequest#index index} is non-empty). If the {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is not
|
495
|
+
# empty, rows will be yielded in an unspecified order.
|
506
496
|
#
|
507
497
|
# It is not an error for the `key_set` to name rows that do not
|
508
498
|
# exist in the database. Read yields nothing for nonexistent rows.
|
@@ -515,9 +505,9 @@ module Google
|
|
515
505
|
# @return [String]
|
516
506
|
# If this request is resuming a previously interrupted read,
|
517
507
|
# `resume_token` should be copied from the last
|
518
|
-
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the
|
519
|
-
#
|
520
|
-
#
|
508
|
+
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
509
|
+
# enables the new read to resume where the last read left off. The
|
510
|
+
# rest of the request parameters must exactly match the request
|
521
511
|
# that yielded this token.
|
522
512
|
# @!attribute [rw] partition_token
|
523
513
|
# @return [String]
|
@@ -527,8 +517,7 @@ module Google
|
|
527
517
|
# PartitionReadRequest message used to create this partition_token.
|
528
518
|
class ReadRequest; end
|
529
519
|
|
530
|
-
# The request for
|
531
|
-
# {Google::Spanner::V1::Spanner::BeginTransaction BeginTransaction}.
|
520
|
+
# The request for {Google::Spanner::V1::Spanner::BeginTransaction BeginTransaction}.
|
532
521
|
# @!attribute [rw] session
|
533
522
|
# @return [String]
|
534
523
|
# Required. The session in which the transaction runs.
|