google-cloud-spanner 1.16.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +23 -0
  4. data/lib/google-cloud-spanner.rb +10 -13
  5. data/lib/google/cloud/spanner.rb +6 -8
  6. data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
  7. data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
  8. data/lib/google/cloud/spanner/backup.rb +1 -1
  9. data/lib/google/cloud/spanner/backup/job.rb +2 -2
  10. data/lib/google/cloud/spanner/backup/job/list.rb +2 -2
  11. data/lib/google/cloud/spanner/backup/list.rb +1 -2
  12. data/lib/google/cloud/spanner/backup/restore/job.rb +2 -2
  13. data/lib/google/cloud/spanner/batch_client.rb +2 -2
  14. data/lib/google/cloud/spanner/batch_snapshot.rb +6 -8
  15. data/lib/google/cloud/spanner/batch_update.rb +1 -1
  16. data/lib/google/cloud/spanner/client.rb +8 -8
  17. data/lib/google/cloud/spanner/commit.rb +14 -14
  18. data/lib/google/cloud/spanner/convert.rb +7 -7
  19. data/lib/google/cloud/spanner/credentials.rb +2 -2
  20. data/lib/google/cloud/spanner/data.rb +2 -2
  21. data/lib/google/cloud/spanner/database.rb +22 -22
  22. data/lib/google/cloud/spanner/database/backup_info.rb +1 -1
  23. data/lib/google/cloud/spanner/database/job.rb +3 -3
  24. data/lib/google/cloud/spanner/database/job/list.rb +2 -2
  25. data/lib/google/cloud/spanner/database/list.rb +1 -1
  26. data/lib/google/cloud/spanner/database/restore_info.rb +1 -1
  27. data/lib/google/cloud/spanner/fields.rb +8 -8
  28. data/lib/google/cloud/spanner/instance.rb +5 -12
  29. data/lib/google/cloud/spanner/instance/config.rb +1 -1
  30. data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
  31. data/lib/google/cloud/spanner/instance/job.rb +2 -2
  32. data/lib/google/cloud/spanner/instance/list.rb +1 -1
  33. data/lib/google/cloud/spanner/partition.rb +4 -4
  34. data/lib/google/cloud/spanner/policy.rb +2 -2
  35. data/lib/google/cloud/spanner/service.rb +209 -297
  36. data/lib/google/cloud/spanner/session.rb +9 -9
  37. data/lib/google/cloud/spanner/snapshot.rb +2 -2
  38. data/lib/google/cloud/spanner/transaction.rb +2 -2
  39. data/lib/google/cloud/spanner/version.rb +1 -1
  40. metadata +18 -107
  41. data/lib/google/cloud/spanner/admin/database.rb +0 -149
  42. data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
  43. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
  44. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
  45. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
  46. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  47. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
  48. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
  49. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
  55. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
  56. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
  57. data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
  58. data/lib/google/cloud/spanner/admin/instance.rb +0 -164
  59. data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
  60. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
  61. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  62. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
  63. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
  64. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
  65. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
  66. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
  67. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
  68. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
  69. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
  70. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
  71. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
  72. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
  73. data/lib/google/cloud/spanner/v1.rb +0 -16
  74. data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
  75. data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
  76. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
  77. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
  78. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
  79. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
  80. data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
  81. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
  82. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
  83. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
  84. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
  85. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
  86. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
  87. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
  88. data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
  89. data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
  90. data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
  91. data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
  92. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
  93. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
  94. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
  95. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
  96. data/lib/google/spanner/v1/keys_pb.rb +0 -34
  97. data/lib/google/spanner/v1/mutation_pb.rb +0 -39
  98. data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
  99. data/lib/google/spanner/v1/result_set_pb.rb +0 -48
  100. data/lib/google/spanner/v1/spanner_pb.rb +0 -179
  101. data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
  102. data/lib/google/spanner/v1/transaction_pb.rb +0 -56
  103. data/lib/google/spanner/v1/type_pb.rb +0 -44
@@ -1,190 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- module Google
17
- module Spanner
18
- module V1
19
- # Results from {Google::Spanner::V1::Spanner::Read Read} or
20
- # {Google::Spanner::V1::Spanner::ExecuteSql ExecuteSql}.
21
- # @!attribute [rw] metadata
22
- # @return [Google::Spanner::V1::ResultSetMetadata]
23
- # Metadata about the result set, such as row type information.
24
- # @!attribute [rw] rows
25
- # @return [Array<Google::Protobuf::ListValue>]
26
- # Each element in `rows` is a row whose format is defined by
27
- # {Google::Spanner::V1::ResultSetMetadata#row_type metadata::row_type}. The ith element
28
- # in each row matches the ith field in
29
- # {Google::Spanner::V1::ResultSetMetadata#row_type metadata::row_type}. Elements are
30
- # encoded based on type as described
31
- # {Google::Spanner::V1::TypeCode here}.
32
- # @!attribute [rw] stats
33
- # @return [Google::Spanner::V1::ResultSetStats]
34
- # Query plan and execution statistics for the SQL statement that
35
- # produced this result set. These can be requested by setting
36
- # {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
37
- # DML statements always produce stats containing the number of rows
38
- # modified, unless executed using the
39
- # {Google::Spanner::V1::ExecuteSqlRequest::QueryMode::PLAN ExecuteSqlRequest::QueryMode::PLAN} {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
40
- # Other fields may or may not be populated, based on the
41
- # {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
42
- class ResultSet; end
43
-
44
- # Partial results from a streaming read or SQL query. Streaming reads and
45
- # SQL queries better tolerate large result sets, large rows, and large
46
- # values, but are a little trickier to consume.
47
- # @!attribute [rw] metadata
48
- # @return [Google::Spanner::V1::ResultSetMetadata]
49
- # Metadata about the result set, such as row type information.
50
- # Only present in the first response.
51
- # @!attribute [rw] values
52
- # @return [Array<Google::Protobuf::Value>]
53
- # A streamed result set consists of a stream of values, which might
54
- # be split into many `PartialResultSet` messages to accommodate
55
- # large rows and/or large values. Every N complete values defines a
56
- # row, where N is equal to the number of entries in
57
- # {Google::Spanner::V1::StructType#fields metadata::row_type::fields}.
58
- #
59
- # Most values are encoded based on type as described
60
- # {Google::Spanner::V1::TypeCode here}.
61
- #
62
- # It is possible that the last value in values is "chunked",
63
- # meaning that the rest of the value is sent in subsequent
64
- # `PartialResultSet`(s). This is denoted by the {Google::Spanner::V1::PartialResultSet#chunked_value chunked_value}
65
- # field. Two or more chunked values can be merged to form a
66
- # complete value as follows:
67
- #
68
- # * `bool/number/null`: cannot be chunked
69
- # * `string`: concatenate the strings
70
- # * `list`: concatenate the lists. If the last element in a list is a
71
- # `string`, `list`, or `object`, merge it with the first element in
72
- # the next list by applying these rules recursively.
73
- # * `object`: concatenate the (field name, field value) pairs. If a
74
- # field name is duplicated, then apply these rules recursively
75
- # to merge the field values.
76
- #
77
- # Some examples of merging:
78
- #
79
- # = Strings are concatenated.
80
- # "foo", "bar" => "foobar"
81
- #
82
- # = Lists of non-strings are concatenated.
83
- # [2, 3], [4] => [2, 3, 4]
84
- #
85
- # = Lists are concatenated, but the last and first elements are merged
86
- # = because they are strings.
87
- # ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
88
- #
89
- # = Lists are concatenated, but the last and first elements are merged
90
- # = because they are lists. Recursively, the last and first elements
91
- # = of the inner lists are merged because they are strings.
92
- # ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
93
- #
94
- # = Non-overlapping object fields are combined.
95
- # {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
96
- #
97
- # = Overlapping object fields are merged.
98
- # {"a": "1"}, {"a": "2"} => {"a": "12"}
99
- #
100
- # = Examples of merging objects containing lists of strings.
101
- # {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
102
- #
103
- # For a more complete example, suppose a streaming SQL query is
104
- # yielding a result set whose rows contain a single string
105
- # field. The following `PartialResultSet`s might be yielded:
106
- #
107
- # {
108
- # "metadata": { ... }
109
- # "values": ["Hello", "W"]
110
- # "chunked_value": true
111
- # "resume_token": "Af65..."
112
- # }
113
- # {
114
- # "values": ["orl"]
115
- # "chunked_value": true
116
- # "resume_token": "Bqp2..."
117
- # }
118
- # {
119
- # "values": ["d"]
120
- # "resume_token": "Zx1B..."
121
- # }
122
- #
123
- # This sequence of `PartialResultSet`s encodes two rows, one
124
- # containing the field value `"Hello"`, and a second containing the
125
- # field value `"World" = "W" + "orl" + "d"`.
126
- # @!attribute [rw] chunked_value
127
- # @return [true, false]
128
- # If true, then the final value in {Google::Spanner::V1::PartialResultSet#values values} is chunked, and must
129
- # be combined with more values from subsequent `PartialResultSet`s
130
- # to obtain a complete field value.
131
- # @!attribute [rw] resume_token
132
- # @return [String]
133
- # Streaming calls might be interrupted for a variety of reasons, such
134
- # as TCP connection loss. If this occurs, the stream of results can
135
- # be resumed by re-sending the original request and including
136
- # `resume_token`. Note that executing any other transaction in the
137
- # same session invalidates the token.
138
- # @!attribute [rw] stats
139
- # @return [Google::Spanner::V1::ResultSetStats]
140
- # Query plan and execution statistics for the statement that produced this
141
- # streaming result set. These can be requested by setting
142
- # {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode} and are sent
143
- # only once with the last response in the stream.
144
- # This field will also be present in the last response for DML
145
- # statements.
146
- class PartialResultSet; end
147
-
148
- # Metadata about a {Google::Spanner::V1::ResultSet ResultSet} or {Google::Spanner::V1::PartialResultSet PartialResultSet}.
149
- # @!attribute [rw] row_type
150
- # @return [Google::Spanner::V1::StructType]
151
- # Indicates the field names and types for the rows in the result
152
- # set. For example, a SQL query like `"SELECT UserId, UserName FROM
153
- # Users"` could return a `row_type` value like:
154
- #
155
- # "fields": [
156
- # { "name": "UserId", "type": { "code": "INT64" } },
157
- # { "name": "UserName", "type": { "code": "STRING" } },
158
- # ]
159
- # @!attribute [rw] transaction
160
- # @return [Google::Spanner::V1::Transaction]
161
- # If the read or SQL query began a transaction as a side-effect, the
162
- # information about the new transaction is yielded here.
163
- class ResultSetMetadata; end
164
-
165
- # Additional statistics about a {Google::Spanner::V1::ResultSet ResultSet} or {Google::Spanner::V1::PartialResultSet PartialResultSet}.
166
- # @!attribute [rw] query_plan
167
- # @return [Google::Spanner::V1::QueryPlan]
168
- # {Google::Spanner::V1::QueryPlan QueryPlan} for the query associated with this result.
169
- # @!attribute [rw] query_stats
170
- # @return [Google::Protobuf::Struct]
171
- # Aggregated statistics from the execution of the query. Only present when
172
- # the query is profiled. For example, a query could return the statistics as
173
- # follows:
174
- #
175
- # {
176
- # "rows_returned": "3",
177
- # "elapsed_time": "1.22 secs",
178
- # "cpu_time": "1.19 secs"
179
- # }
180
- # @!attribute [rw] row_count_exact
181
- # @return [Integer]
182
- # Standard DML returns an exact count of rows that were modified.
183
- # @!attribute [rw] row_count_lower_bound
184
- # @return [Integer]
185
- # Partitioned DML does not offer exactly-once semantics, so it
186
- # returns a lower bound of the rows modified.
187
- class ResultSetStats; end
188
- end
189
- end
190
- end
@@ -1,570 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- module Google
17
- module Spanner
18
- module V1
19
- # The request for {Google::Spanner::V1::Spanner::CreateSession CreateSession}.
20
- # @!attribute [rw] database
21
- # @return [String]
22
- # Required. The database in which the new session is created.
23
- # @!attribute [rw] session
24
- # @return [Google::Spanner::V1::Session]
25
- # The session to create.
26
- class CreateSessionRequest; end
27
-
28
- # The request for {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
29
- # @!attribute [rw] database
30
- # @return [String]
31
- # Required. The database in which the new sessions are created.
32
- # @!attribute [rw] session_template
33
- # @return [Google::Spanner::V1::Session]
34
- # Parameters to be applied to each created session.
35
- # @!attribute [rw] session_count
36
- # @return [Integer]
37
- # Required. The number of sessions to be created in this batch call.
38
- # The API may return fewer than the requested number of sessions. If a
39
- # specific number of sessions are desired, the client can make additional
40
- # calls to BatchCreateSessions (adjusting
41
- # {Google::Spanner::V1::BatchCreateSessionsRequest#session_count session_count} as necessary).
42
- class BatchCreateSessionsRequest; end
43
-
44
- # The response for {Google::Spanner::V1::Spanner::BatchCreateSessions BatchCreateSessions}.
45
- # @!attribute [rw] session
46
- # @return [Array<Google::Spanner::V1::Session>]
47
- # The freshly created sessions.
48
- class BatchCreateSessionsResponse; end
49
-
50
- # A session in the Cloud Spanner API.
51
- # @!attribute [rw] name
52
- # @return [String]
53
- # The name of the session. This is always system-assigned; values provided
54
- # when creating a session are ignored.
55
- # @!attribute [rw] labels
56
- # @return [Hash{String => String}]
57
- # The labels for the session.
58
- #
59
- # * Label keys must be between 1 and 63 characters long and must conform to
60
- # the following regular expression: `[a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?`.
61
- # * Label values must be between 0 and 63 characters long and must conform
62
- # to the regular expression `([a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?)?`.
63
- # * No more than 64 labels can be associated with a given session.
64
- #
65
- # See https://goo.gl/xmQnxf for more information on and examples of labels.
66
- # @!attribute [rw] create_time
67
- # @return [Google::Protobuf::Timestamp]
68
- # Output only. The timestamp when the session is created.
69
- # @!attribute [rw] approximate_last_use_time
70
- # @return [Google::Protobuf::Timestamp]
71
- # Output only. The approximate timestamp when the session is last used. It is
72
- # typically earlier than the actual last use time.
73
- class Session; end
74
-
75
- # The request for {Google::Spanner::V1::Spanner::GetSession GetSession}.
76
- # @!attribute [rw] name
77
- # @return [String]
78
- # Required. The name of the session to retrieve.
79
- class GetSessionRequest; end
80
-
81
- # The request for {Google::Spanner::V1::Spanner::ListSessions ListSessions}.
82
- # @!attribute [rw] database
83
- # @return [String]
84
- # Required. The database in which to list sessions.
85
- # @!attribute [rw] page_size
86
- # @return [Integer]
87
- # Number of sessions to be returned in the response. If 0 or less, defaults
88
- # to the server's maximum allowed page size.
89
- # @!attribute [rw] page_token
90
- # @return [String]
91
- # If non-empty, `page_token` should contain a
92
- # {Google::Spanner::V1::ListSessionsResponse#next_page_token next_page_token} from a previous
93
- # {Google::Spanner::V1::ListSessionsResponse ListSessionsResponse}.
94
- # @!attribute [rw] filter
95
- # @return [String]
96
- # An expression for filtering the results of the request. Filter rules are
97
- # case insensitive. The fields eligible for filtering are:
98
- #
99
- # * `labels.key` where key is the name of a label
100
- #
101
- # Some examples of using filters are:
102
- #
103
- # * `labels.env:*` --> The session has the label "env".
104
- # * `labels.env:dev` --> The session has the label "env" and the value of
105
- # the label contains the string "dev".
106
- class ListSessionsRequest; end
107
-
108
- # The response for {Google::Spanner::V1::Spanner::ListSessions ListSessions}.
109
- # @!attribute [rw] sessions
110
- # @return [Array<Google::Spanner::V1::Session>]
111
- # The list of requested sessions.
112
- # @!attribute [rw] next_page_token
113
- # @return [String]
114
- # `next_page_token` can be sent in a subsequent
115
- # {Google::Spanner::V1::Spanner::ListSessions ListSessions} call to fetch more of the matching
116
- # sessions.
117
- class ListSessionsResponse; end
118
-
119
- # The request for {Google::Spanner::V1::Spanner::DeleteSession DeleteSession}.
120
- # @!attribute [rw] name
121
- # @return [String]
122
- # Required. The name of the session to delete.
123
- class DeleteSessionRequest; end
124
-
125
- # The request for {Google::Spanner::V1::Spanner::ExecuteSql ExecuteSql} and
126
- # {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql}.
127
- # @!attribute [rw] session
128
- # @return [String]
129
- # Required. The session in which the SQL query should be performed.
130
- # @!attribute [rw] transaction
131
- # @return [Google::Spanner::V1::TransactionSelector]
132
- # The transaction to use.
133
- #
134
- # For queries, if none is provided, the default is a temporary read-only
135
- # transaction with strong concurrency.
136
- #
137
- # Standard DML statements require a read-write transaction. To protect
138
- # against replays, single-use transactions are not supported. The caller
139
- # must either supply an existing transaction ID or begin a new transaction.
140
- #
141
- # Partitioned DML requires an existing Partitioned DML transaction ID.
142
- # @!attribute [rw] sql
143
- # @return [String]
144
- # Required. The SQL string.
145
- # @!attribute [rw] params
146
- # @return [Google::Protobuf::Struct]
147
- # Parameter names and values that bind to placeholders in the SQL string.
148
- #
149
- # A parameter placeholder consists of the `@` character followed by the
150
- # parameter name (for example, `@firstName`). Parameter names can contain
151
- # letters, numbers, and underscores.
152
- #
153
- # Parameters can appear anywhere that a literal value is expected. The same
154
- # parameter name can be used more than once, for example:
155
- #
156
- # `"WHERE id > @msg_id AND id < @msg_id + 100"`
157
- #
158
- # It is an error to execute a SQL statement with unbound parameters.
159
- # @!attribute [rw] param_types
160
- # @return [Hash{String => Google::Spanner::V1::Type}]
161
- # It is not always possible for Cloud Spanner to infer the right SQL type
162
- # from a JSON value. For example, values of type `BYTES` and values
163
- # of type `STRING` both appear in {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
164
- #
165
- # In these cases, `param_types` can be used to specify the exact
166
- # SQL type for some or all of the SQL statement parameters. See the
167
- # definition of {Google::Spanner::V1::Type Type} for more information
168
- # about SQL types.
169
- # @!attribute [rw] resume_token
170
- # @return [String]
171
- # If this request is resuming a previously interrupted SQL statement
172
- # execution, `resume_token` should be copied from the last
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.
177
- # @!attribute [rw] query_mode
178
- # @return [Google::Spanner::V1::ExecuteSqlRequest::QueryMode]
179
- # Used to control the amount of debugging information returned in
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}.
182
- # @!attribute [rw] partition_token
183
- # @return [String]
184
- # If present, results will be restricted to the specified partition
185
- # previously created using PartitionQuery(). There must be an exact
186
- # match for the values of fields common to this message and the
187
- # PartitionQueryRequest message used to create this partition_token.
188
- # @!attribute [rw] seqno
189
- # @return [Integer]
190
- # A per-transaction sequence number used to identify this request. This field
191
- # makes each request idempotent such that if the request is received multiple
192
- # times, at most one will succeed.
193
- #
194
- # The sequence number must be monotonically increasing within the
195
- # transaction. If a request arrives for the first time with an out-of-order
196
- # sequence number, the transaction may be aborted. Replays of previously
197
- # handled requests will yield the same response as the first execution.
198
- #
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.
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
-
225
- # Mode in which the statement must be processed.
226
- module QueryMode
227
- # The default mode. Only the statement results are returned.
228
- NORMAL = 0
229
-
230
- # This mode returns only the query plan, without any results or
231
- # execution statistics information.
232
- PLAN = 1
233
-
234
- # This mode returns both the query plan and the execution statistics along
235
- # with the results.
236
- PROFILE = 2
237
- end
238
- end
239
-
240
- # The request for {Google::Spanner::V1::Spanner::ExecuteBatchDml ExecuteBatchDml}.
241
- # @!attribute [rw] session
242
- # @return [String]
243
- # Required. The session in which the DML statements should be performed.
244
- # @!attribute [rw] transaction
245
- # @return [Google::Spanner::V1::TransactionSelector]
246
- # Required. The transaction to use. Must be a read-write transaction.
247
- #
248
- # To protect against replays, single-use transactions are not supported. The
249
- # caller must either supply an existing transaction ID or begin a new
250
- # transaction.
251
- # @!attribute [rw] statements
252
- # @return [Array<Google::Spanner::V1::ExecuteBatchDmlRequest::Statement>]
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.
257
- #
258
- # Callers must provide at least one statement.
259
- # @!attribute [rw] seqno
260
- # @return [Integer]
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.
264
- #
265
- # The sequence number must be monotonically increasing within the
266
- # transaction. If a request arrives for the first time with an out-of-order
267
- # sequence number, the transaction may be aborted. Replays of previously
268
- # handled requests will yield the same response as the first execution.
269
- class ExecuteBatchDmlRequest
270
- # A single DML statement.
271
- # @!attribute [rw] sql
272
- # @return [String]
273
- # Required. The DML string.
274
- # @!attribute [rw] params
275
- # @return [Google::Protobuf::Struct]
276
- # Parameter names and values that bind to placeholders in the DML string.
277
- #
278
- # A parameter placeholder consists of the `@` character followed by the
279
- # parameter name (for example, `@firstName`). Parameter names can contain
280
- # letters, numbers, and underscores.
281
- #
282
- # Parameters can appear anywhere that a literal value is expected. The
283
- # same parameter name can be used more than once, for example:
284
- #
285
- # `"WHERE id > @msg_id AND id < @msg_id + 100"`
286
- #
287
- # It is an error to execute a SQL statement with unbound parameters.
288
- # @!attribute [rw] param_types
289
- # @return [Hash{String => Google::Spanner::V1::Type}]
290
- # It is not always possible for Cloud Spanner to infer the right SQL type
291
- # from a JSON value. For example, values of type `BYTES` and values
292
- # of type `STRING` both appear in {Google::Spanner::V1::ExecuteBatchDmlRequest::Statement#params params} as JSON strings.
293
- #
294
- # In these cases, `param_types` can be used to specify the exact
295
- # SQL type for some or all of the SQL statement parameters. See the
296
- # definition of {Google::Spanner::V1::Type Type} for more information
297
- # about SQL types.
298
- class Statement; end
299
- end
300
-
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.
305
- #
306
- # To check for DML statements that failed, use the following approach:
307
- #
308
- # 1. Check the status in the response message. The {Google::Rpc::Code} enum
309
- # value `OK` indicates that all statements were executed successfully.
310
- # 2. If the status was not `OK`, check the number of result sets in the
311
- # response. If the response contains `N` {Google::Spanner::V1::ResultSet ResultSet} messages, then
312
- # statement `N+1` in the request failed.
313
- #
314
- # Example 1:
315
- #
316
- # * Request: 5 DML statements, all executed successfully.
317
- # * Response: 5 {Google::Spanner::V1::ResultSet ResultSet} messages, with the status `OK`.
318
- #
319
- # Example 2:
320
- #
321
- # * Request: 5 DML statements. The third statement has a syntax error.
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.
325
- # @!attribute [rw] result_sets
326
- # @return [Array<Google::Spanner::V1::ResultSet>]
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}.
334
- # @!attribute [rw] status
335
- # @return [Google::Rpc::Status]
336
- # If all DML statements are executed successfully, the status is `OK`.
337
- # Otherwise, the error status of the first failed statement.
338
- class ExecuteBatchDmlResponse; end
339
-
340
- # Options for a PartitionQueryRequest and
341
- # PartitionReadRequest.
342
- # @!attribute [rw] partition_size_bytes
343
- # @return [Integer]
344
- # **Note:** This hint is currently ignored by PartitionQuery and
345
- # PartitionRead requests.
346
- #
347
- # The desired data size for each partition generated. The default for this
348
- # option is currently 1 GiB. This is only a hint. The actual size of each
349
- # partition may be smaller or larger than this size request.
350
- # @!attribute [rw] max_partitions
351
- # @return [Integer]
352
- # **Note:** This hint is currently ignored by PartitionQuery and
353
- # PartitionRead requests.
354
- #
355
- # The desired maximum number of partitions to return. For example, this may
356
- # be set to the number of workers available. The default for this option
357
- # is currently 10,000. The maximum value is currently 200,000. This is only
358
- # a hint. The actual number of partitions returned may be smaller or larger
359
- # than this maximum count request.
360
- class PartitionOptions; end
361
-
362
- # The request for {Google::Spanner::V1::Spanner::PartitionQuery PartitionQuery}
363
- # @!attribute [rw] session
364
- # @return [String]
365
- # Required. The session used to create the partitions.
366
- # @!attribute [rw] transaction
367
- # @return [Google::Spanner::V1::TransactionSelector]
368
- # Read only snapshot transactions are supported, read/write and single use
369
- # transactions are not.
370
- # @!attribute [rw] sql
371
- # @return [String]
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
374
- # partitionable query has a single distributed union operator. A distributed
375
- # union operator conceptually divides one or more tables into multiple
376
- # splits, remotely evaluates a subquery independently on each split, and
377
- # then unions all results.
378
- #
379
- # This must not contain DML commands, such as INSERT, UPDATE, or
380
- # DELETE. Use {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql} with a
381
- # PartitionedDml transaction for large, partition-friendly DML operations.
382
- # @!attribute [rw] params
383
- # @return [Google::Protobuf::Struct]
384
- # Parameter names and values that bind to placeholders in the SQL string.
385
- #
386
- # A parameter placeholder consists of the `@` character followed by the
387
- # parameter name (for example, `@firstName`). Parameter names can contain
388
- # letters, numbers, and underscores.
389
- #
390
- # Parameters can appear anywhere that a literal value is expected. The same
391
- # parameter name can be used more than once, for example:
392
- #
393
- # `"WHERE id > @msg_id AND id < @msg_id + 100"`
394
- #
395
- # It is an error to execute a SQL statement with unbound parameters.
396
- # @!attribute [rw] param_types
397
- # @return [Hash{String => Google::Spanner::V1::Type}]
398
- # It is not always possible for Cloud Spanner to infer the right SQL type
399
- # from a JSON value. For example, values of type `BYTES` and values
400
- # of type `STRING` both appear in {Google::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
401
- #
402
- # In these cases, `param_types` can be used to specify the exact
403
- # SQL type for some or all of the SQL query parameters. See the
404
- # definition of {Google::Spanner::V1::Type Type} for more information
405
- # about SQL types.
406
- # @!attribute [rw] partition_options
407
- # @return [Google::Spanner::V1::PartitionOptions]
408
- # Additional options that affect how many partitions are created.
409
- class PartitionQueryRequest; end
410
-
411
- # The request for {Google::Spanner::V1::Spanner::PartitionRead PartitionRead}
412
- # @!attribute [rw] session
413
- # @return [String]
414
- # Required. The session used to create the partitions.
415
- # @!attribute [rw] transaction
416
- # @return [Google::Spanner::V1::TransactionSelector]
417
- # Read only snapshot transactions are supported, read/write and single use
418
- # transactions are not.
419
- # @!attribute [rw] table
420
- # @return [String]
421
- # Required. The name of the table in the database to be read.
422
- # @!attribute [rw] index
423
- # @return [String]
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
- # @!attribute [rw] columns
428
- # @return [Array<String>]
429
- # The columns of {Google::Spanner::V1::PartitionReadRequest#table table} to be returned for each row matching
430
- # this request.
431
- # @!attribute [rw] key_set
432
- # @return [Google::Spanner::V1::KeySet]
433
- # Required. `key_set` identifies the rows to be yielded. `key_set` names the
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
436
- # index keys in {Google::Spanner::V1::PartitionReadRequest#index index}.
437
- #
438
- # It is not an error for the `key_set` to name rows that do not
439
- # exist in the database. Read yields nothing for nonexistent rows.
440
- # @!attribute [rw] partition_options
441
- # @return [Google::Spanner::V1::PartitionOptions]
442
- # Additional options that affect how many partitions are created.
443
- class PartitionReadRequest; end
444
-
445
- # Information returned for each partition returned in a
446
- # PartitionResponse.
447
- # @!attribute [rw] partition_token
448
- # @return [String]
449
- # This token can be passed to Read, StreamingRead, ExecuteSql, or
450
- # ExecuteStreamingSql requests to restrict the results to those identified by
451
- # this partition token.
452
- class Partition; end
453
-
454
- # The response for {Google::Spanner::V1::Spanner::PartitionQuery PartitionQuery}
455
- # or {Google::Spanner::V1::Spanner::PartitionRead PartitionRead}
456
- # @!attribute [rw] partitions
457
- # @return [Array<Google::Spanner::V1::Partition>]
458
- # Partitions created by this request.
459
- # @!attribute [rw] transaction
460
- # @return [Google::Spanner::V1::Transaction]
461
- # Transaction created by this request.
462
- class PartitionResponse; end
463
-
464
- # The request for {Google::Spanner::V1::Spanner::Read Read} and
465
- # {Google::Spanner::V1::Spanner::StreamingRead StreamingRead}.
466
- # @!attribute [rw] session
467
- # @return [String]
468
- # Required. The session in which the read should be performed.
469
- # @!attribute [rw] transaction
470
- # @return [Google::Spanner::V1::TransactionSelector]
471
- # The transaction to use. If none is provided, the default is a
472
- # temporary read-only transaction with strong concurrency.
473
- # @!attribute [rw] table
474
- # @return [String]
475
- # Required. The name of the table in the database to be read.
476
- # @!attribute [rw] index
477
- # @return [String]
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.
481
- # @!attribute [rw] columns
482
- # @return [Array<String>]
483
- # Required. The columns of {Google::Spanner::V1::ReadRequest#table table} to be returned for each row matching
484
- # this request.
485
- # @!attribute [rw] key_set
486
- # @return [Google::Spanner::V1::KeySet]
487
- # Required. `key_set` identifies the rows to be yielded. `key_set` names the
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.
496
- #
497
- # It is not an error for the `key_set` to name rows that do not
498
- # exist in the database. Read yields nothing for nonexistent rows.
499
- # @!attribute [rw] limit
500
- # @return [Integer]
501
- # If greater than zero, only the first `limit` rows are yielded. If `limit`
502
- # is zero, the default is no limit. A limit cannot be specified if
503
- # `partition_token` is set.
504
- # @!attribute [rw] resume_token
505
- # @return [String]
506
- # If this request is resuming a previously interrupted read,
507
- # `resume_token` should be copied from the last
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
511
- # that yielded this token.
512
- # @!attribute [rw] partition_token
513
- # @return [String]
514
- # If present, results will be restricted to the specified partition
515
- # previously created using PartitionRead(). There must be an exact
516
- # match for the values of fields common to this message and the
517
- # PartitionReadRequest message used to create this partition_token.
518
- class ReadRequest; end
519
-
520
- # The request for {Google::Spanner::V1::Spanner::BeginTransaction BeginTransaction}.
521
- # @!attribute [rw] session
522
- # @return [String]
523
- # Required. The session in which the transaction runs.
524
- # @!attribute [rw] options
525
- # @return [Google::Spanner::V1::TransactionOptions]
526
- # Required. Options for the new transaction.
527
- class BeginTransactionRequest; end
528
-
529
- # The request for {Google::Spanner::V1::Spanner::Commit Commit}.
530
- # @!attribute [rw] session
531
- # @return [String]
532
- # Required. The session in which the transaction to be committed is running.
533
- # @!attribute [rw] transaction_id
534
- # @return [String]
535
- # Commit a previously-started transaction.
536
- # @!attribute [rw] single_use_transaction
537
- # @return [Google::Spanner::V1::TransactionOptions]
538
- # Execute mutations in a temporary transaction. Note that unlike
539
- # commit of a previously-started transaction, commit with a
540
- # temporary transaction is non-idempotent. That is, if the
541
- # `CommitRequest` is sent to Cloud Spanner more than once (for
542
- # instance, due to retries in the application, or in the
543
- # transport library), it is possible that the mutations are
544
- # executed more than once. If this is undesirable, use
545
- # {Google::Spanner::V1::Spanner::BeginTransaction BeginTransaction} and
546
- # {Google::Spanner::V1::Spanner::Commit Commit} instead.
547
- # @!attribute [rw] mutations
548
- # @return [Array<Google::Spanner::V1::Mutation>]
549
- # The mutations to be executed when this transaction commits. All
550
- # mutations are applied atomically, in the order they appear in
551
- # this list.
552
- class CommitRequest; end
553
-
554
- # The response for {Google::Spanner::V1::Spanner::Commit Commit}.
555
- # @!attribute [rw] commit_timestamp
556
- # @return [Google::Protobuf::Timestamp]
557
- # The Cloud Spanner timestamp at which the transaction committed.
558
- class CommitResponse; end
559
-
560
- # The request for {Google::Spanner::V1::Spanner::Rollback Rollback}.
561
- # @!attribute [rw] session
562
- # @return [String]
563
- # Required. The session in which the transaction to roll back is running.
564
- # @!attribute [rw] transaction_id
565
- # @return [String]
566
- # Required. The transaction to roll back.
567
- class RollbackRequest; end
568
- end
569
- end
570
- end