google-cloud-spanner-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-spanner-v1.rb +21 -0
  7. data/lib/google/cloud/spanner/v1.rb +35 -0
  8. data/lib/google/cloud/spanner/v1/spanner.rb +52 -0
  9. data/lib/google/cloud/spanner/v1/spanner/client.rb +1947 -0
  10. data/lib/google/cloud/spanner/v1/spanner/credentials.rb +52 -0
  11. data/lib/google/cloud/spanner/v1/spanner/paths.rb +73 -0
  12. data/lib/google/cloud/spanner/v1/version.rb +28 -0
  13. data/lib/google/spanner/v1/keys_pb.rb +37 -0
  14. data/lib/google/spanner/v1/mutation_pb.rb +42 -0
  15. data/lib/google/spanner/v1/query_plan_pb.rb +51 -0
  16. data/lib/google/spanner/v1/result_set_pb.rb +51 -0
  17. data/lib/google/spanner/v1/spanner_pb.rb +182 -0
  18. data/lib/google/spanner/v1/spanner_services_pb.rb +180 -0
  19. data/lib/google/spanner/v1/transaction_pb.rb +59 -0
  20. data/lib/google/spanner/v1/type_pb.rb +47 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/field_behavior.rb +59 -0
  23. data/proto_docs/google/api/resource.rb +247 -0
  24. data/proto_docs/google/protobuf/any.rb +138 -0
  25. data/proto_docs/google/protobuf/duration.rb +98 -0
  26. data/proto_docs/google/protobuf/empty.rb +36 -0
  27. data/proto_docs/google/protobuf/struct.rb +96 -0
  28. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  29. data/proto_docs/google/rpc/status.rb +46 -0
  30. data/proto_docs/google/spanner/v1/keys.rb +162 -0
  31. data/proto_docs/google/spanner/v1/mutation.rb +110 -0
  32. data/proto_docs/google/spanner/v1/query_plan.rb +148 -0
  33. data/proto_docs/google/spanner/v1/result_set.rb +208 -0
  34. data/proto_docs/google/spanner/v1/spanner.rb +681 -0
  35. data/proto_docs/google/spanner/v1/transaction.rb +457 -0
  36. data/proto_docs/google/spanner/v1/type.rb +127 -0
  37. metadata +218 -0
@@ -0,0 +1,208 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Spanner
23
+ module V1
24
+ # Results from {::Google::Cloud::Spanner::V1::Spanner::Client#read Read} or
25
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#execute_sql ExecuteSql}.
26
+ # @!attribute [rw] metadata
27
+ # @return [::Google::Cloud::Spanner::V1::ResultSetMetadata]
28
+ # Metadata about the result set, such as row type information.
29
+ # @!attribute [rw] rows
30
+ # @return [::Array<::Google::Protobuf::ListValue>]
31
+ # Each element in `rows` is a row whose format is defined by
32
+ # {::Google::Cloud::Spanner::V1::ResultSetMetadata#row_type metadata.row_type}. The ith element
33
+ # in each row matches the ith field in
34
+ # {::Google::Cloud::Spanner::V1::ResultSetMetadata#row_type metadata.row_type}. Elements are
35
+ # encoded based on type as described
36
+ # {::Google::Cloud::Spanner::V1::TypeCode here}.
37
+ # @!attribute [rw] stats
38
+ # @return [::Google::Cloud::Spanner::V1::ResultSetStats]
39
+ # Query plan and execution statistics for the SQL statement that
40
+ # produced this result set. These can be requested by setting
41
+ # {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest.query_mode}.
42
+ # DML statements always produce stats containing the number of rows
43
+ # modified, unless executed using the
44
+ # {::Google::Cloud::Spanner::V1::ExecuteSqlRequest::QueryMode::PLAN ExecuteSqlRequest.QueryMode.PLAN} {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest.query_mode}.
45
+ # Other fields may or may not be populated, based on the
46
+ # {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest.query_mode}.
47
+ class ResultSet
48
+ include ::Google::Protobuf::MessageExts
49
+ extend ::Google::Protobuf::MessageExts::ClassMethods
50
+ end
51
+
52
+ # Partial results from a streaming read or SQL query. Streaming reads and
53
+ # SQL queries better tolerate large result sets, large rows, and large
54
+ # values, but are a little trickier to consume.
55
+ # @!attribute [rw] metadata
56
+ # @return [::Google::Cloud::Spanner::V1::ResultSetMetadata]
57
+ # Metadata about the result set, such as row type information.
58
+ # Only present in the first response.
59
+ # @!attribute [rw] values
60
+ # @return [::Array<::Google::Protobuf::Value>]
61
+ # A streamed result set consists of a stream of values, which might
62
+ # be split into many `PartialResultSet` messages to accommodate
63
+ # large rows and/or large values. Every N complete values defines a
64
+ # row, where N is equal to the number of entries in
65
+ # {::Google::Cloud::Spanner::V1::StructType#fields metadata.row_type.fields}.
66
+ #
67
+ # Most values are encoded based on type as described
68
+ # {::Google::Cloud::Spanner::V1::TypeCode here}.
69
+ #
70
+ # It is possible that the last value in values is "chunked",
71
+ # meaning that the rest of the value is sent in subsequent
72
+ # `PartialResultSet`(s). This is denoted by the {::Google::Cloud::Spanner::V1::PartialResultSet#chunked_value chunked_value}
73
+ # field. Two or more chunked values can be merged to form a
74
+ # complete value as follows:
75
+ #
76
+ # * `bool/number/null`: cannot be chunked
77
+ # * `string`: concatenate the strings
78
+ # * `list`: concatenate the lists. If the last element in a list is a
79
+ # `string`, `list`, or `object`, merge it with the first element in
80
+ # the next list by applying these rules recursively.
81
+ # * `object`: concatenate the (field name, field value) pairs. If a
82
+ # field name is duplicated, then apply these rules recursively
83
+ # to merge the field values.
84
+ #
85
+ # Some examples of merging:
86
+ #
87
+ # # Strings are concatenated.
88
+ # "foo", "bar" => "foobar"
89
+ #
90
+ # # Lists of non-strings are concatenated.
91
+ # [2, 3], [4] => [2, 3, 4]
92
+ #
93
+ # # Lists are concatenated, but the last and first elements are merged
94
+ # # because they are strings.
95
+ # ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
96
+ #
97
+ # # Lists are concatenated, but the last and first elements are merged
98
+ # # because they are lists. Recursively, the last and first elements
99
+ # # of the inner lists are merged because they are strings.
100
+ # ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
101
+ #
102
+ # # Non-overlapping object fields are combined.
103
+ # {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
104
+ #
105
+ # # Overlapping object fields are merged.
106
+ # {"a": "1"}, {"a": "2"} => {"a": "12"}
107
+ #
108
+ # # Examples of merging objects containing lists of strings.
109
+ # {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
110
+ #
111
+ # For a more complete example, suppose a streaming SQL query is
112
+ # yielding a result set whose rows contain a single string
113
+ # field. The following `PartialResultSet`s might be yielded:
114
+ #
115
+ # {
116
+ # "metadata": { ... }
117
+ # "values": ["Hello", "W"]
118
+ # "chunked_value": true
119
+ # "resume_token": "Af65..."
120
+ # }
121
+ # {
122
+ # "values": ["orl"]
123
+ # "chunked_value": true
124
+ # "resume_token": "Bqp2..."
125
+ # }
126
+ # {
127
+ # "values": ["d"]
128
+ # "resume_token": "Zx1B..."
129
+ # }
130
+ #
131
+ # This sequence of `PartialResultSet`s encodes two rows, one
132
+ # containing the field value `"Hello"`, and a second containing the
133
+ # field value `"World" = "W" + "orl" + "d"`.
134
+ # @!attribute [rw] chunked_value
135
+ # @return [::Boolean]
136
+ # If true, then the final value in {::Google::Cloud::Spanner::V1::PartialResultSet#values values} is chunked, and must
137
+ # be combined with more values from subsequent `PartialResultSet`s
138
+ # to obtain a complete field value.
139
+ # @!attribute [rw] resume_token
140
+ # @return [::String]
141
+ # Streaming calls might be interrupted for a variety of reasons, such
142
+ # as TCP connection loss. If this occurs, the stream of results can
143
+ # be resumed by re-sending the original request and including
144
+ # `resume_token`. Note that executing any other transaction in the
145
+ # same session invalidates the token.
146
+ # @!attribute [rw] stats
147
+ # @return [::Google::Cloud::Spanner::V1::ResultSetStats]
148
+ # Query plan and execution statistics for the statement that produced this
149
+ # streaming result set. These can be requested by setting
150
+ # {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest.query_mode} and are sent
151
+ # only once with the last response in the stream.
152
+ # This field will also be present in the last response for DML
153
+ # statements.
154
+ class PartialResultSet
155
+ include ::Google::Protobuf::MessageExts
156
+ extend ::Google::Protobuf::MessageExts::ClassMethods
157
+ end
158
+
159
+ # Metadata about a {::Google::Cloud::Spanner::V1::ResultSet ResultSet} or {::Google::Cloud::Spanner::V1::PartialResultSet PartialResultSet}.
160
+ # @!attribute [rw] row_type
161
+ # @return [::Google::Cloud::Spanner::V1::StructType]
162
+ # Indicates the field names and types for the rows in the result
163
+ # set. For example, a SQL query like `"SELECT UserId, UserName FROM
164
+ # Users"` could return a `row_type` value like:
165
+ #
166
+ # "fields": [
167
+ # { "name": "UserId", "type": { "code": "INT64" } },
168
+ # { "name": "UserName", "type": { "code": "STRING" } },
169
+ # ]
170
+ # @!attribute [rw] transaction
171
+ # @return [::Google::Cloud::Spanner::V1::Transaction]
172
+ # If the read or SQL query began a transaction as a side-effect, the
173
+ # information about the new transaction is yielded here.
174
+ class ResultSetMetadata
175
+ include ::Google::Protobuf::MessageExts
176
+ extend ::Google::Protobuf::MessageExts::ClassMethods
177
+ end
178
+
179
+ # Additional statistics about a {::Google::Cloud::Spanner::V1::ResultSet ResultSet} or {::Google::Cloud::Spanner::V1::PartialResultSet PartialResultSet}.
180
+ # @!attribute [rw] query_plan
181
+ # @return [::Google::Cloud::Spanner::V1::QueryPlan]
182
+ # {::Google::Cloud::Spanner::V1::QueryPlan QueryPlan} for the query associated with this result.
183
+ # @!attribute [rw] query_stats
184
+ # @return [::Google::Protobuf::Struct]
185
+ # Aggregated statistics from the execution of the query. Only present when
186
+ # the query is profiled. For example, a query could return the statistics as
187
+ # follows:
188
+ #
189
+ # {
190
+ # "rows_returned": "3",
191
+ # "elapsed_time": "1.22 secs",
192
+ # "cpu_time": "1.19 secs"
193
+ # }
194
+ # @!attribute [rw] row_count_exact
195
+ # @return [::Integer]
196
+ # Standard DML returns an exact count of rows that were modified.
197
+ # @!attribute [rw] row_count_lower_bound
198
+ # @return [::Integer]
199
+ # Partitioned DML does not offer exactly-once semantics, so it
200
+ # returns a lower bound of the rows modified.
201
+ class ResultSetStats
202
+ include ::Google::Protobuf::MessageExts
203
+ extend ::Google::Protobuf::MessageExts::ClassMethods
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,681 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Spanner
23
+ module V1
24
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#create_session CreateSession}.
25
+ # @!attribute [rw] database
26
+ # @return [::String]
27
+ # Required. The database in which the new session is created.
28
+ # @!attribute [rw] session
29
+ # @return [::Google::Cloud::Spanner::V1::Session]
30
+ # The session to create.
31
+ class CreateSessionRequest
32
+ include ::Google::Protobuf::MessageExts
33
+ extend ::Google::Protobuf::MessageExts::ClassMethods
34
+ end
35
+
36
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#batch_create_sessions BatchCreateSessions}.
37
+ # @!attribute [rw] database
38
+ # @return [::String]
39
+ # Required. The database in which the new sessions are created.
40
+ # @!attribute [rw] session_template
41
+ # @return [::Google::Cloud::Spanner::V1::Session]
42
+ # Parameters to be applied to each created session.
43
+ # @!attribute [rw] session_count
44
+ # @return [::Integer]
45
+ # Required. The number of sessions to be created in this batch call.
46
+ # The API may return fewer than the requested number of sessions. If a
47
+ # specific number of sessions are desired, the client can make additional
48
+ # calls to BatchCreateSessions (adjusting
49
+ # {::Google::Cloud::Spanner::V1::BatchCreateSessionsRequest#session_count session_count} as necessary).
50
+ class BatchCreateSessionsRequest
51
+ include ::Google::Protobuf::MessageExts
52
+ extend ::Google::Protobuf::MessageExts::ClassMethods
53
+ end
54
+
55
+ # The response for {::Google::Cloud::Spanner::V1::Spanner::Client#batch_create_sessions BatchCreateSessions}.
56
+ # @!attribute [rw] session
57
+ # @return [::Array<::Google::Cloud::Spanner::V1::Session>]
58
+ # The freshly created sessions.
59
+ class BatchCreateSessionsResponse
60
+ include ::Google::Protobuf::MessageExts
61
+ extend ::Google::Protobuf::MessageExts::ClassMethods
62
+ end
63
+
64
+ # A session in the Cloud Spanner API.
65
+ # @!attribute [rw] name
66
+ # @return [::String]
67
+ # The name of the session. This is always system-assigned; values provided
68
+ # when creating a session are ignored.
69
+ # @!attribute [rw] labels
70
+ # @return [::Google::Protobuf::Map{::String => ::String}]
71
+ # The labels for the session.
72
+ #
73
+ # * Label keys must be between 1 and 63 characters long and must conform to
74
+ # the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
75
+ # * Label values must be between 0 and 63 characters long and must conform
76
+ # to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
77
+ # * No more than 64 labels can be associated with a given session.
78
+ #
79
+ # See https://goo.gl/xmQnxf for more information on and examples of labels.
80
+ # @!attribute [rw] create_time
81
+ # @return [::Google::Protobuf::Timestamp]
82
+ # Output only. The timestamp when the session is created.
83
+ # @!attribute [rw] approximate_last_use_time
84
+ # @return [::Google::Protobuf::Timestamp]
85
+ # Output only. The approximate timestamp when the session is last used. It is
86
+ # typically earlier than the actual last use time.
87
+ class Session
88
+ include ::Google::Protobuf::MessageExts
89
+ extend ::Google::Protobuf::MessageExts::ClassMethods
90
+
91
+ # @!attribute [rw] key
92
+ # @return [::String]
93
+ # @!attribute [rw] value
94
+ # @return [::String]
95
+ class LabelsEntry
96
+ include ::Google::Protobuf::MessageExts
97
+ extend ::Google::Protobuf::MessageExts::ClassMethods
98
+ end
99
+ end
100
+
101
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#get_session GetSession}.
102
+ # @!attribute [rw] name
103
+ # @return [::String]
104
+ # Required. The name of the session to retrieve.
105
+ class GetSessionRequest
106
+ include ::Google::Protobuf::MessageExts
107
+ extend ::Google::Protobuf::MessageExts::ClassMethods
108
+ end
109
+
110
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#list_sessions ListSessions}.
111
+ # @!attribute [rw] database
112
+ # @return [::String]
113
+ # Required. The database in which to list sessions.
114
+ # @!attribute [rw] page_size
115
+ # @return [::Integer]
116
+ # Number of sessions to be returned in the response. If 0 or less, defaults
117
+ # to the server's maximum allowed page size.
118
+ # @!attribute [rw] page_token
119
+ # @return [::String]
120
+ # If non-empty, `page_token` should contain a
121
+ # {::Google::Cloud::Spanner::V1::ListSessionsResponse#next_page_token next_page_token} from a previous
122
+ # {::Google::Cloud::Spanner::V1::ListSessionsResponse ListSessionsResponse}.
123
+ # @!attribute [rw] filter
124
+ # @return [::String]
125
+ # An expression for filtering the results of the request. Filter rules are
126
+ # case insensitive. The fields eligible for filtering are:
127
+ #
128
+ # * `labels.key` where key is the name of a label
129
+ #
130
+ # Some examples of using filters are:
131
+ #
132
+ # * `labels.env:*` --> The session has the label "env".
133
+ # * `labels.env:dev` --> The session has the label "env" and the value of
134
+ # the label contains the string "dev".
135
+ class ListSessionsRequest
136
+ include ::Google::Protobuf::MessageExts
137
+ extend ::Google::Protobuf::MessageExts::ClassMethods
138
+ end
139
+
140
+ # The response for {::Google::Cloud::Spanner::V1::Spanner::Client#list_sessions ListSessions}.
141
+ # @!attribute [rw] sessions
142
+ # @return [::Array<::Google::Cloud::Spanner::V1::Session>]
143
+ # The list of requested sessions.
144
+ # @!attribute [rw] next_page_token
145
+ # @return [::String]
146
+ # `next_page_token` can be sent in a subsequent
147
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#list_sessions ListSessions} call to fetch more of the matching
148
+ # sessions.
149
+ class ListSessionsResponse
150
+ include ::Google::Protobuf::MessageExts
151
+ extend ::Google::Protobuf::MessageExts::ClassMethods
152
+ end
153
+
154
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#delete_session DeleteSession}.
155
+ # @!attribute [rw] name
156
+ # @return [::String]
157
+ # Required. The name of the session to delete.
158
+ class DeleteSessionRequest
159
+ include ::Google::Protobuf::MessageExts
160
+ extend ::Google::Protobuf::MessageExts::ClassMethods
161
+ end
162
+
163
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#execute_sql ExecuteSql} and
164
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#execute_streaming_sql ExecuteStreamingSql}.
165
+ # @!attribute [rw] session
166
+ # @return [::String]
167
+ # Required. The session in which the SQL query should be performed.
168
+ # @!attribute [rw] transaction
169
+ # @return [::Google::Cloud::Spanner::V1::TransactionSelector]
170
+ # The transaction to use.
171
+ #
172
+ # For queries, if none is provided, the default is a temporary read-only
173
+ # transaction with strong concurrency.
174
+ #
175
+ # Standard DML statements require a read-write transaction. To protect
176
+ # against replays, single-use transactions are not supported. The caller
177
+ # must either supply an existing transaction ID or begin a new transaction.
178
+ #
179
+ # Partitioned DML requires an existing Partitioned DML transaction ID.
180
+ # @!attribute [rw] sql
181
+ # @return [::String]
182
+ # Required. The SQL string.
183
+ # @!attribute [rw] params
184
+ # @return [::Google::Protobuf::Struct]
185
+ # Parameter names and values that bind to placeholders in the SQL string.
186
+ #
187
+ # A parameter placeholder consists of the `@` character followed by the
188
+ # parameter name (for example, `@firstName`). Parameter names can contain
189
+ # letters, numbers, and underscores.
190
+ #
191
+ # Parameters can appear anywhere that a literal value is expected. The same
192
+ # parameter name can be used more than once, for example:
193
+ #
194
+ # `"WHERE id > @msg_id AND id < @msg_id + 100"`
195
+ #
196
+ # It is an error to execute a SQL statement with unbound parameters.
197
+ # @!attribute [rw] param_types
198
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Spanner::V1::Type}]
199
+ # It is not always possible for Cloud Spanner to infer the right SQL type
200
+ # from a JSON value. For example, values of type `BYTES` and values
201
+ # of type `STRING` both appear in {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
202
+ #
203
+ # In these cases, `param_types` can be used to specify the exact
204
+ # SQL type for some or all of the SQL statement parameters. See the
205
+ # definition of {::Google::Cloud::Spanner::V1::Type Type} for more information
206
+ # about SQL types.
207
+ # @!attribute [rw] resume_token
208
+ # @return [::String]
209
+ # If this request is resuming a previously interrupted SQL statement
210
+ # execution, `resume_token` should be copied from the last
211
+ # {::Google::Cloud::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
212
+ # enables the new SQL statement execution to resume where the last one left
213
+ # off. The rest of the request parameters must exactly match the
214
+ # request that yielded this token.
215
+ # @!attribute [rw] query_mode
216
+ # @return [::Google::Cloud::Spanner::V1::ExecuteSqlRequest::QueryMode]
217
+ # Used to control the amount of debugging information returned in
218
+ # {::Google::Cloud::Spanner::V1::ResultSetStats ResultSetStats}. If {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#partition_token partition_token} is set, {::Google::Cloud::Spanner::V1::ExecuteSqlRequest#query_mode query_mode} can only
219
+ # be set to {::Google::Cloud::Spanner::V1::ExecuteSqlRequest::QueryMode::NORMAL QueryMode.NORMAL}.
220
+ # @!attribute [rw] partition_token
221
+ # @return [::String]
222
+ # If present, results will be restricted to the specified partition
223
+ # previously created using PartitionQuery(). There must be an exact
224
+ # match for the values of fields common to this message and the
225
+ # PartitionQueryRequest message used to create this partition_token.
226
+ # @!attribute [rw] seqno
227
+ # @return [::Integer]
228
+ # A per-transaction sequence number used to identify this request. This field
229
+ # makes each request idempotent such that if the request is received multiple
230
+ # times, at most one will succeed.
231
+ #
232
+ # The sequence number must be monotonically increasing within the
233
+ # transaction. If a request arrives for the first time with an out-of-order
234
+ # sequence number, the transaction may be aborted. Replays of previously
235
+ # handled requests will yield the same response as the first execution.
236
+ #
237
+ # Required for DML statements. Ignored for queries.
238
+ # @!attribute [rw] query_options
239
+ # @return [::Google::Cloud::Spanner::V1::ExecuteSqlRequest::QueryOptions]
240
+ # Query optimizer configuration to use for the given query.
241
+ class ExecuteSqlRequest
242
+ include ::Google::Protobuf::MessageExts
243
+ extend ::Google::Protobuf::MessageExts::ClassMethods
244
+
245
+ # Query optimizer configuration.
246
+ # @!attribute [rw] optimizer_version
247
+ # @return [::String]
248
+ # An option to control the selection of optimizer version.
249
+ #
250
+ # This parameter allows individual queries to pick different query
251
+ # optimizer versions.
252
+ #
253
+ # Specifying "latest" as a value instructs Cloud Spanner to use the
254
+ # latest supported query optimizer version. If not specified, Cloud Spanner
255
+ # uses optimizer version set at the database level options. Any other
256
+ # positive integer (from the list of supported optimizer versions)
257
+ # overrides the default optimizer version for query execution.
258
+ # The list of supported optimizer versions can be queried from
259
+ # SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
260
+ # with an invalid optimizer version will fail with a syntax error
261
+ # (`INVALID_ARGUMENT`) status.
262
+ #
263
+ # The `optimizer_version` statement hint has precedence over this setting.
264
+ class QueryOptions
265
+ include ::Google::Protobuf::MessageExts
266
+ extend ::Google::Protobuf::MessageExts::ClassMethods
267
+ end
268
+
269
+ # @!attribute [rw] key
270
+ # @return [::String]
271
+ # @!attribute [rw] value
272
+ # @return [::Google::Cloud::Spanner::V1::Type]
273
+ class ParamTypesEntry
274
+ include ::Google::Protobuf::MessageExts
275
+ extend ::Google::Protobuf::MessageExts::ClassMethods
276
+ end
277
+
278
+ # Mode in which the statement must be processed.
279
+ module QueryMode
280
+ # The default mode. Only the statement results are returned.
281
+ NORMAL = 0
282
+
283
+ # This mode returns only the query plan, without any results or
284
+ # execution statistics information.
285
+ PLAN = 1
286
+
287
+ # This mode returns both the query plan and the execution statistics along
288
+ # with the results.
289
+ PROFILE = 2
290
+ end
291
+ end
292
+
293
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#execute_batch_dml ExecuteBatchDml}.
294
+ # @!attribute [rw] session
295
+ # @return [::String]
296
+ # Required. The session in which the DML statements should be performed.
297
+ # @!attribute [rw] transaction
298
+ # @return [::Google::Cloud::Spanner::V1::TransactionSelector]
299
+ # Required. The transaction to use. Must be a read-write transaction.
300
+ #
301
+ # To protect against replays, single-use transactions are not supported. The
302
+ # caller must either supply an existing transaction ID or begin a new
303
+ # transaction.
304
+ # @!attribute [rw] statements
305
+ # @return [::Array<::Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest::Statement>]
306
+ # Required. The list of statements to execute in this batch. Statements are executed
307
+ # serially, such that the effects of statement `i` are visible to statement
308
+ # `i+1`. Each statement must be a DML statement. Execution stops at the
309
+ # first failed statement; the remaining statements are not executed.
310
+ #
311
+ # Callers must provide at least one statement.
312
+ # @!attribute [rw] seqno
313
+ # @return [::Integer]
314
+ # Required. A per-transaction sequence number used to identify this request. This field
315
+ # makes each request idempotent such that if the request is received multiple
316
+ # times, at most one will succeed.
317
+ #
318
+ # The sequence number must be monotonically increasing within the
319
+ # transaction. If a request arrives for the first time with an out-of-order
320
+ # sequence number, the transaction may be aborted. Replays of previously
321
+ # handled requests will yield the same response as the first execution.
322
+ class ExecuteBatchDmlRequest
323
+ include ::Google::Protobuf::MessageExts
324
+ extend ::Google::Protobuf::MessageExts::ClassMethods
325
+
326
+ # A single DML statement.
327
+ # @!attribute [rw] sql
328
+ # @return [::String]
329
+ # Required. The DML string.
330
+ # @!attribute [rw] params
331
+ # @return [::Google::Protobuf::Struct]
332
+ # Parameter names and values that bind to placeholders in the DML string.
333
+ #
334
+ # A parameter placeholder consists of the `@` character followed by the
335
+ # parameter name (for example, `@firstName`). Parameter names can contain
336
+ # letters, numbers, and underscores.
337
+ #
338
+ # Parameters can appear anywhere that a literal value is expected. The
339
+ # same parameter name can be used more than once, for example:
340
+ #
341
+ # `"WHERE id > @msg_id AND id < @msg_id + 100"`
342
+ #
343
+ # It is an error to execute a SQL statement with unbound parameters.
344
+ # @!attribute [rw] param_types
345
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Spanner::V1::Type}]
346
+ # It is not always possible for Cloud Spanner to infer the right SQL type
347
+ # from a JSON value. For example, values of type `BYTES` and values
348
+ # of type `STRING` both appear in {::Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest::Statement#params params} as JSON strings.
349
+ #
350
+ # In these cases, `param_types` can be used to specify the exact
351
+ # SQL type for some or all of the SQL statement parameters. See the
352
+ # definition of {::Google::Cloud::Spanner::V1::Type Type} for more information
353
+ # about SQL types.
354
+ class Statement
355
+ include ::Google::Protobuf::MessageExts
356
+ extend ::Google::Protobuf::MessageExts::ClassMethods
357
+
358
+ # @!attribute [rw] key
359
+ # @return [::String]
360
+ # @!attribute [rw] value
361
+ # @return [::Google::Cloud::Spanner::V1::Type]
362
+ class ParamTypesEntry
363
+ include ::Google::Protobuf::MessageExts
364
+ extend ::Google::Protobuf::MessageExts::ClassMethods
365
+ end
366
+ end
367
+ end
368
+
369
+ # The response for {::Google::Cloud::Spanner::V1::Spanner::Client#execute_batch_dml ExecuteBatchDml}. Contains a list
370
+ # of {::Google::Cloud::Spanner::V1::ResultSet ResultSet} messages, one for each DML statement that has successfully
371
+ # executed, in the same order as the statements in the request. If a statement
372
+ # fails, the status in the response body identifies the cause of the failure.
373
+ #
374
+ # To check for DML statements that failed, use the following approach:
375
+ #
376
+ # 1. Check the status in the response message. The [google.rpc.Code][google.rpc.Code] enum
377
+ # value `OK` indicates that all statements were executed successfully.
378
+ # 2. If the status was not `OK`, check the number of result sets in the
379
+ # response. If the response contains `N` {::Google::Cloud::Spanner::V1::ResultSet ResultSet} messages, then
380
+ # statement `N+1` in the request failed.
381
+ #
382
+ # Example 1:
383
+ #
384
+ # * Request: 5 DML statements, all executed successfully.
385
+ # * Response: 5 {::Google::Cloud::Spanner::V1::ResultSet ResultSet} messages, with the status `OK`.
386
+ #
387
+ # Example 2:
388
+ #
389
+ # * Request: 5 DML statements. The third statement has a syntax error.
390
+ # * Response: 2 {::Google::Cloud::Spanner::V1::ResultSet ResultSet} messages, and a syntax error (`INVALID_ARGUMENT`)
391
+ # status. The number of {::Google::Cloud::Spanner::V1::ResultSet ResultSet} messages indicates that the third
392
+ # statement failed, and the fourth and fifth statements were not executed.
393
+ # @!attribute [rw] result_sets
394
+ # @return [::Array<::Google::Cloud::Spanner::V1::ResultSet>]
395
+ # One {::Google::Cloud::Spanner::V1::ResultSet ResultSet} for each statement in the request that ran successfully,
396
+ # in the same order as the statements in the request. Each {::Google::Cloud::Spanner::V1::ResultSet ResultSet} does
397
+ # not contain any rows. The {::Google::Cloud::Spanner::V1::ResultSetStats ResultSetStats} in each {::Google::Cloud::Spanner::V1::ResultSet ResultSet} contain
398
+ # the number of rows modified by the statement.
399
+ #
400
+ # Only the first {::Google::Cloud::Spanner::V1::ResultSet ResultSet} in the response contains valid
401
+ # {::Google::Cloud::Spanner::V1::ResultSetMetadata ResultSetMetadata}.
402
+ # @!attribute [rw] status
403
+ # @return [::Google::Rpc::Status]
404
+ # If all DML statements are executed successfully, the status is `OK`.
405
+ # Otherwise, the error status of the first failed statement.
406
+ class ExecuteBatchDmlResponse
407
+ include ::Google::Protobuf::MessageExts
408
+ extend ::Google::Protobuf::MessageExts::ClassMethods
409
+ end
410
+
411
+ # Options for a PartitionQueryRequest and
412
+ # PartitionReadRequest.
413
+ # @!attribute [rw] partition_size_bytes
414
+ # @return [::Integer]
415
+ # **Note:** This hint is currently ignored by PartitionQuery and
416
+ # PartitionRead requests.
417
+ #
418
+ # The desired data size for each partition generated. The default for this
419
+ # option is currently 1 GiB. This is only a hint. The actual size of each
420
+ # partition may be smaller or larger than this size request.
421
+ # @!attribute [rw] max_partitions
422
+ # @return [::Integer]
423
+ # **Note:** This hint is currently ignored by PartitionQuery and
424
+ # PartitionRead requests.
425
+ #
426
+ # The desired maximum number of partitions to return. For example, this may
427
+ # be set to the number of workers available. The default for this option
428
+ # is currently 10,000. The maximum value is currently 200,000. This is only
429
+ # a hint. The actual number of partitions returned may be smaller or larger
430
+ # than this maximum count request.
431
+ class PartitionOptions
432
+ include ::Google::Protobuf::MessageExts
433
+ extend ::Google::Protobuf::MessageExts::ClassMethods
434
+ end
435
+
436
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#partition_query PartitionQuery}
437
+ # @!attribute [rw] session
438
+ # @return [::String]
439
+ # Required. The session used to create the partitions.
440
+ # @!attribute [rw] transaction
441
+ # @return [::Google::Cloud::Spanner::V1::TransactionSelector]
442
+ # Read only snapshot transactions are supported, read/write and single use
443
+ # transactions are not.
444
+ # @!attribute [rw] sql
445
+ # @return [::String]
446
+ # Required. The query request to generate partitions for. The request will fail if
447
+ # the query is not root partitionable. The query plan of a root
448
+ # partitionable query has a single distributed union operator. A distributed
449
+ # union operator conceptually divides one or more tables into multiple
450
+ # splits, remotely evaluates a subquery independently on each split, and
451
+ # then unions all results.
452
+ #
453
+ # This must not contain DML commands, such as INSERT, UPDATE, or
454
+ # DELETE. Use {::Google::Cloud::Spanner::V1::Spanner::Client#execute_streaming_sql ExecuteStreamingSql} with a
455
+ # PartitionedDml transaction for large, partition-friendly DML operations.
456
+ # @!attribute [rw] params
457
+ # @return [::Google::Protobuf::Struct]
458
+ # Parameter names and values that bind to placeholders in the SQL string.
459
+ #
460
+ # A parameter placeholder consists of the `@` character followed by the
461
+ # parameter name (for example, `@firstName`). Parameter names can contain
462
+ # letters, numbers, and underscores.
463
+ #
464
+ # Parameters can appear anywhere that a literal value is expected. The same
465
+ # parameter name can be used more than once, for example:
466
+ #
467
+ # `"WHERE id > @msg_id AND id < @msg_id + 100"`
468
+ #
469
+ # It is an error to execute a SQL statement with unbound parameters.
470
+ # @!attribute [rw] param_types
471
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Spanner::V1::Type}]
472
+ # It is not always possible for Cloud Spanner to infer the right SQL type
473
+ # from a JSON value. For example, values of type `BYTES` and values
474
+ # of type `STRING` both appear in {::Google::Cloud::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
475
+ #
476
+ # In these cases, `param_types` can be used to specify the exact
477
+ # SQL type for some or all of the SQL query parameters. See the
478
+ # definition of {::Google::Cloud::Spanner::V1::Type Type} for more information
479
+ # about SQL types.
480
+ # @!attribute [rw] partition_options
481
+ # @return [::Google::Cloud::Spanner::V1::PartitionOptions]
482
+ # Additional options that affect how many partitions are created.
483
+ class PartitionQueryRequest
484
+ include ::Google::Protobuf::MessageExts
485
+ extend ::Google::Protobuf::MessageExts::ClassMethods
486
+
487
+ # @!attribute [rw] key
488
+ # @return [::String]
489
+ # @!attribute [rw] value
490
+ # @return [::Google::Cloud::Spanner::V1::Type]
491
+ class ParamTypesEntry
492
+ include ::Google::Protobuf::MessageExts
493
+ extend ::Google::Protobuf::MessageExts::ClassMethods
494
+ end
495
+ end
496
+
497
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#partition_read PartitionRead}
498
+ # @!attribute [rw] session
499
+ # @return [::String]
500
+ # Required. The session used to create the partitions.
501
+ # @!attribute [rw] transaction
502
+ # @return [::Google::Cloud::Spanner::V1::TransactionSelector]
503
+ # Read only snapshot transactions are supported, read/write and single use
504
+ # transactions are not.
505
+ # @!attribute [rw] table
506
+ # @return [::String]
507
+ # Required. The name of the table in the database to be read.
508
+ # @!attribute [rw] index
509
+ # @return [::String]
510
+ # If non-empty, the name of an index on {::Google::Cloud::Spanner::V1::PartitionReadRequest#table table}. This index is
511
+ # used instead of the table primary key when interpreting {::Google::Cloud::Spanner::V1::PartitionReadRequest#key_set key_set}
512
+ # and sorting result rows. See {::Google::Cloud::Spanner::V1::PartitionReadRequest#key_set key_set} for further information.
513
+ # @!attribute [rw] columns
514
+ # @return [::Array<::String>]
515
+ # The columns of {::Google::Cloud::Spanner::V1::PartitionReadRequest#table table} to be returned for each row matching
516
+ # this request.
517
+ # @!attribute [rw] key_set
518
+ # @return [::Google::Cloud::Spanner::V1::KeySet]
519
+ # Required. `key_set` identifies the rows to be yielded. `key_set` names the
520
+ # primary keys of the rows in {::Google::Cloud::Spanner::V1::PartitionReadRequest#table table} to be yielded, unless {::Google::Cloud::Spanner::V1::PartitionReadRequest#index index}
521
+ # is present. If {::Google::Cloud::Spanner::V1::PartitionReadRequest#index index} is present, then {::Google::Cloud::Spanner::V1::PartitionReadRequest#key_set key_set} instead names
522
+ # index keys in {::Google::Cloud::Spanner::V1::PartitionReadRequest#index index}.
523
+ #
524
+ # It is not an error for the `key_set` to name rows that do not
525
+ # exist in the database. Read yields nothing for nonexistent rows.
526
+ # @!attribute [rw] partition_options
527
+ # @return [::Google::Cloud::Spanner::V1::PartitionOptions]
528
+ # Additional options that affect how many partitions are created.
529
+ class PartitionReadRequest
530
+ include ::Google::Protobuf::MessageExts
531
+ extend ::Google::Protobuf::MessageExts::ClassMethods
532
+ end
533
+
534
+ # Information returned for each partition returned in a
535
+ # PartitionResponse.
536
+ # @!attribute [rw] partition_token
537
+ # @return [::String]
538
+ # This token can be passed to Read, StreamingRead, ExecuteSql, or
539
+ # ExecuteStreamingSql requests to restrict the results to those identified by
540
+ # this partition token.
541
+ class Partition
542
+ include ::Google::Protobuf::MessageExts
543
+ extend ::Google::Protobuf::MessageExts::ClassMethods
544
+ end
545
+
546
+ # The response for {::Google::Cloud::Spanner::V1::Spanner::Client#partition_query PartitionQuery}
547
+ # or {::Google::Cloud::Spanner::V1::Spanner::Client#partition_read PartitionRead}
548
+ # @!attribute [rw] partitions
549
+ # @return [::Array<::Google::Cloud::Spanner::V1::Partition>]
550
+ # Partitions created by this request.
551
+ # @!attribute [rw] transaction
552
+ # @return [::Google::Cloud::Spanner::V1::Transaction]
553
+ # Transaction created by this request.
554
+ class PartitionResponse
555
+ include ::Google::Protobuf::MessageExts
556
+ extend ::Google::Protobuf::MessageExts::ClassMethods
557
+ end
558
+
559
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#read Read} and
560
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#streaming_read StreamingRead}.
561
+ # @!attribute [rw] session
562
+ # @return [::String]
563
+ # Required. The session in which the read should be performed.
564
+ # @!attribute [rw] transaction
565
+ # @return [::Google::Cloud::Spanner::V1::TransactionSelector]
566
+ # The transaction to use. If none is provided, the default is a
567
+ # temporary read-only transaction with strong concurrency.
568
+ # @!attribute [rw] table
569
+ # @return [::String]
570
+ # Required. The name of the table in the database to be read.
571
+ # @!attribute [rw] index
572
+ # @return [::String]
573
+ # If non-empty, the name of an index on {::Google::Cloud::Spanner::V1::ReadRequest#table table}. This index is
574
+ # used instead of the table primary key when interpreting {::Google::Cloud::Spanner::V1::ReadRequest#key_set key_set}
575
+ # and sorting result rows. See {::Google::Cloud::Spanner::V1::ReadRequest#key_set key_set} for further information.
576
+ # @!attribute [rw] columns
577
+ # @return [::Array<::String>]
578
+ # Required. The columns of {::Google::Cloud::Spanner::V1::ReadRequest#table table} to be returned for each row matching
579
+ # this request.
580
+ # @!attribute [rw] key_set
581
+ # @return [::Google::Cloud::Spanner::V1::KeySet]
582
+ # Required. `key_set` identifies the rows to be yielded. `key_set` names the
583
+ # primary keys of the rows in {::Google::Cloud::Spanner::V1::ReadRequest#table table} to be yielded, unless {::Google::Cloud::Spanner::V1::ReadRequest#index index}
584
+ # is present. If {::Google::Cloud::Spanner::V1::ReadRequest#index index} is present, then {::Google::Cloud::Spanner::V1::ReadRequest#key_set key_set} instead names
585
+ # index keys in {::Google::Cloud::Spanner::V1::ReadRequest#index index}.
586
+ #
587
+ # If the {::Google::Cloud::Spanner::V1::ReadRequest#partition_token partition_token} field is empty, rows are yielded
588
+ # in table primary key order (if {::Google::Cloud::Spanner::V1::ReadRequest#index index} is empty) or index key order
589
+ # (if {::Google::Cloud::Spanner::V1::ReadRequest#index index} is non-empty). If the {::Google::Cloud::Spanner::V1::ReadRequest#partition_token partition_token} field is not
590
+ # empty, rows will be yielded in an unspecified order.
591
+ #
592
+ # It is not an error for the `key_set` to name rows that do not
593
+ # exist in the database. Read yields nothing for nonexistent rows.
594
+ # @!attribute [rw] limit
595
+ # @return [::Integer]
596
+ # If greater than zero, only the first `limit` rows are yielded. If `limit`
597
+ # is zero, the default is no limit. A limit cannot be specified if
598
+ # `partition_token` is set.
599
+ # @!attribute [rw] resume_token
600
+ # @return [::String]
601
+ # If this request is resuming a previously interrupted read,
602
+ # `resume_token` should be copied from the last
603
+ # {::Google::Cloud::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
604
+ # enables the new read to resume where the last read left off. The
605
+ # rest of the request parameters must exactly match the request
606
+ # that yielded this token.
607
+ # @!attribute [rw] partition_token
608
+ # @return [::String]
609
+ # If present, results will be restricted to the specified partition
610
+ # previously created using PartitionRead(). There must be an exact
611
+ # match for the values of fields common to this message and the
612
+ # PartitionReadRequest message used to create this partition_token.
613
+ class ReadRequest
614
+ include ::Google::Protobuf::MessageExts
615
+ extend ::Google::Protobuf::MessageExts::ClassMethods
616
+ end
617
+
618
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#begin_transaction BeginTransaction}.
619
+ # @!attribute [rw] session
620
+ # @return [::String]
621
+ # Required. The session in which the transaction runs.
622
+ # @!attribute [rw] options
623
+ # @return [::Google::Cloud::Spanner::V1::TransactionOptions]
624
+ # Required. Options for the new transaction.
625
+ class BeginTransactionRequest
626
+ include ::Google::Protobuf::MessageExts
627
+ extend ::Google::Protobuf::MessageExts::ClassMethods
628
+ end
629
+
630
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#commit Commit}.
631
+ # @!attribute [rw] session
632
+ # @return [::String]
633
+ # Required. The session in which the transaction to be committed is running.
634
+ # @!attribute [rw] transaction_id
635
+ # @return [::String]
636
+ # Commit a previously-started transaction.
637
+ # @!attribute [rw] single_use_transaction
638
+ # @return [::Google::Cloud::Spanner::V1::TransactionOptions]
639
+ # Execute mutations in a temporary transaction. Note that unlike
640
+ # commit of a previously-started transaction, commit with a
641
+ # temporary transaction is non-idempotent. That is, if the
642
+ # `CommitRequest` is sent to Cloud Spanner more than once (for
643
+ # instance, due to retries in the application, or in the
644
+ # transport library), it is possible that the mutations are
645
+ # executed more than once. If this is undesirable, use
646
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#begin_transaction BeginTransaction} and
647
+ # {::Google::Cloud::Spanner::V1::Spanner::Client#commit Commit} instead.
648
+ # @!attribute [rw] mutations
649
+ # @return [::Array<::Google::Cloud::Spanner::V1::Mutation>]
650
+ # The mutations to be executed when this transaction commits. All
651
+ # mutations are applied atomically, in the order they appear in
652
+ # this list.
653
+ class CommitRequest
654
+ include ::Google::Protobuf::MessageExts
655
+ extend ::Google::Protobuf::MessageExts::ClassMethods
656
+ end
657
+
658
+ # The response for {::Google::Cloud::Spanner::V1::Spanner::Client#commit Commit}.
659
+ # @!attribute [rw] commit_timestamp
660
+ # @return [::Google::Protobuf::Timestamp]
661
+ # The Cloud Spanner timestamp at which the transaction committed.
662
+ class CommitResponse
663
+ include ::Google::Protobuf::MessageExts
664
+ extend ::Google::Protobuf::MessageExts::ClassMethods
665
+ end
666
+
667
+ # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#rollback Rollback}.
668
+ # @!attribute [rw] session
669
+ # @return [::String]
670
+ # Required. The session in which the transaction to roll back is running.
671
+ # @!attribute [rw] transaction_id
672
+ # @return [::String]
673
+ # Required. The transaction to roll back.
674
+ class RollbackRequest
675
+ include ::Google::Protobuf::MessageExts
676
+ extend ::Google::Protobuf::MessageExts::ClassMethods
677
+ end
678
+ end
679
+ end
680
+ end
681
+ end