google-cloud-spanner 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/google-cloud-spanner.rb +106 -0
- data/lib/google/cloud/spanner.rb +382 -0
- data/lib/google/cloud/spanner/admin/database/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +703 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +73 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +188 -0
- data/lib/google/cloud/spanner/admin/instance/v1.rb +17 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +139 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +114 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +268 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +868 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +78 -0
- data/lib/google/cloud/spanner/client.rb +1034 -0
- data/lib/google/cloud/spanner/commit.rb +351 -0
- data/lib/google/cloud/spanner/convert.rb +311 -0
- data/lib/google/cloud/spanner/credentials.rb +32 -0
- data/lib/google/cloud/spanner/data.rb +199 -0
- data/lib/google/cloud/spanner/database.rb +377 -0
- data/lib/google/cloud/spanner/database/job.rb +179 -0
- data/lib/google/cloud/spanner/database/list.rb +171 -0
- data/lib/google/cloud/spanner/errors.rb +73 -0
- data/lib/google/cloud/spanner/fields.rb +252 -0
- data/lib/google/cloud/spanner/instance.rb +472 -0
- data/lib/google/cloud/spanner/instance/config.rb +99 -0
- data/lib/google/cloud/spanner/instance/config/list.rb +171 -0
- data/lib/google/cloud/spanner/instance/job.rb +197 -0
- data/lib/google/cloud/spanner/instance/list.rb +167 -0
- data/lib/google/cloud/spanner/policy.rb +201 -0
- data/lib/google/cloud/spanner/pool.rb +279 -0
- data/lib/google/cloud/spanner/project.rb +480 -0
- data/lib/google/cloud/spanner/range.rb +99 -0
- data/lib/google/cloud/spanner/results.rb +280 -0
- data/lib/google/cloud/spanner/service.rb +458 -0
- data/lib/google/cloud/spanner/session.rb +565 -0
- data/lib/google/cloud/spanner/snapshot.rb +260 -0
- data/lib/google/cloud/spanner/transaction.rb +533 -0
- data/lib/google/cloud/spanner/v1.rb +17 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +77 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +73 -0
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +81 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +148 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +80 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +120 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +175 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +206 -0
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +351 -0
- data/lib/google/cloud/spanner/v1/spanner_client.rb +850 -0
- data/lib/google/cloud/spanner/v1/spanner_client_config.json +78 -0
- data/lib/google/cloud/spanner/version.rb +22 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +85 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +95 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +106 -0
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +180 -0
- data/lib/google/spanner/v1/keys_pb.rb +33 -0
- data/lib/google/spanner/v1/mutation_pb.rb +38 -0
- data/lib/google/spanner/v1/query_plan_pb.rb +47 -0
- data/lib/google/spanner/v1/result_set_pb.rb +43 -0
- data/lib/google/spanner/v1/spanner_pb.rb +90 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +131 -0
- data/lib/google/spanner/v1/transaction_pb.rb +51 -0
- data/lib/google/spanner/v1/type_pb.rb +43 -0
- metadata +309 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# Node information for nodes appearing in a QueryPlan#plan_nodes.
|
19
|
+
# @!attribute [rw] index
|
20
|
+
# @return [Integer]
|
21
|
+
# The +PlanNode+'s index in Node list.
|
22
|
+
# @!attribute [rw] kind
|
23
|
+
# @return [Google::Spanner::V1::PlanNode::Kind]
|
24
|
+
# Used to determine the type of node. May be needed for visualizing
|
25
|
+
# different kinds of nodes differently. For example, If the node is a
|
26
|
+
# SCALAR node, it will have a condensed representation
|
27
|
+
# which can be used to directly embed a description of the node in its
|
28
|
+
# parent.
|
29
|
+
# @!attribute [rw] display_name
|
30
|
+
# @return [String]
|
31
|
+
# The display name for the node.
|
32
|
+
# @!attribute [rw] child_links
|
33
|
+
# @return [Array<Google::Spanner::V1::PlanNode::ChildLink>]
|
34
|
+
# List of child node +index+es and their relationship to this parent.
|
35
|
+
# @!attribute [rw] short_representation
|
36
|
+
# @return [Google::Spanner::V1::PlanNode::ShortRepresentation]
|
37
|
+
# Condensed representation for SCALAR nodes.
|
38
|
+
# @!attribute [rw] metadata
|
39
|
+
# @return [Google::Protobuf::Struct]
|
40
|
+
# Attributes relevant to the node contained in a group of key-value pairs.
|
41
|
+
# For example, a Parameter Reference node could have the following
|
42
|
+
# information in its metadata:
|
43
|
+
#
|
44
|
+
# {
|
45
|
+
# "parameter_reference": "param1",
|
46
|
+
# "parameter_type": "array"
|
47
|
+
# }
|
48
|
+
# @!attribute [rw] execution_stats
|
49
|
+
# @return [Google::Protobuf::Struct]
|
50
|
+
# The execution statistics associated with the node, contained in a group of
|
51
|
+
# key-value pairs. Only present if the plan was returned as a result of a
|
52
|
+
# profile query. For example, number of executions, number of rows/time per
|
53
|
+
# execution etc.
|
54
|
+
class PlanNode
|
55
|
+
# Metadata associated with a parent-child relationship appearing in a
|
56
|
+
# PlanNode.
|
57
|
+
# @!attribute [rw] child_index
|
58
|
+
# @return [Integer]
|
59
|
+
# The node to which the link points.
|
60
|
+
# @!attribute [rw] type
|
61
|
+
# @return [String]
|
62
|
+
# The type of the link. For example, in Hash Joins this could be used to
|
63
|
+
# distinguish between the build child and the probe child, or in the case
|
64
|
+
# of the child being an output variable, to represent the tag associated
|
65
|
+
# with the output variable.
|
66
|
+
# @!attribute [rw] variable
|
67
|
+
# @return [String]
|
68
|
+
# Only present if the child node is SCALAR and corresponds
|
69
|
+
# to an output variable of the parent node. The field carries the name of
|
70
|
+
# the output variable.
|
71
|
+
# For example, a +TableScan+ operator that reads rows from a table will
|
72
|
+
# have child links to the +SCALAR+ nodes representing the output variables
|
73
|
+
# created for each column that is read by the operator. The corresponding
|
74
|
+
# +variable+ fields will be set to the variable names assigned to the
|
75
|
+
# columns.
|
76
|
+
class ChildLink; end
|
77
|
+
|
78
|
+
# Condensed representation of a node and its subtree. Only present for
|
79
|
+
# +SCALAR+ PlanNode(s).
|
80
|
+
# @!attribute [rw] description
|
81
|
+
# @return [String]
|
82
|
+
# A string representation of the expression subtree rooted at this node.
|
83
|
+
# @!attribute [rw] subqueries
|
84
|
+
# @return [Hash{String => Integer}]
|
85
|
+
# A mapping of (subquery variable name) -> (subquery node id) for cases
|
86
|
+
# where the +description+ string of this node references a +SCALAR+
|
87
|
+
# subquery contained in the expression subtree rooted at this node. The
|
88
|
+
# referenced +SCALAR+ subquery may not necessarily be a direct child of
|
89
|
+
# this node.
|
90
|
+
class ShortRepresentation; end
|
91
|
+
|
92
|
+
# The kind of PlanNode. Distinguishes between the two different kinds of
|
93
|
+
# nodes that can appear in a query plan.
|
94
|
+
module Kind
|
95
|
+
# Not specified.
|
96
|
+
KIND_UNSPECIFIED = 0
|
97
|
+
|
98
|
+
# Denotes a Relational operator node in the expression tree. Relational
|
99
|
+
# operators represent iterative processing of rows during query execution.
|
100
|
+
# For example, a +TableScan+ operation that reads rows from a table.
|
101
|
+
RELATIONAL = 1
|
102
|
+
|
103
|
+
# Denotes a Scalar node in the expression tree. Scalar nodes represent
|
104
|
+
# non-iterable entities in the query plan. For example, constants or
|
105
|
+
# arithmetic operators appearing inside predicate expressions or references
|
106
|
+
# to column names.
|
107
|
+
SCALAR = 2
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Contains an ordered list of nodes appearing in the query plan.
|
112
|
+
# @!attribute [rw] plan_nodes
|
113
|
+
# @return [Array<Google::Spanner::V1::PlanNode>]
|
114
|
+
# The nodes in the query plan. Plan nodes are returned in pre-order starting
|
115
|
+
# with the plan root. Each PlanNode's +id+ corresponds to its index in
|
116
|
+
# +plan_nodes+.
|
117
|
+
class QueryPlan; end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# Results from Read or
|
19
|
+
# ExecuteSql.
|
20
|
+
# @!attribute [rw] metadata
|
21
|
+
# @return [Google::Spanner::V1::ResultSetMetadata]
|
22
|
+
# Metadata about the result set, such as row type information.
|
23
|
+
# @!attribute [rw] rows
|
24
|
+
# @return [Array<Google::Protobuf::ListValue>]
|
25
|
+
# Each element in +rows+ is a row whose format is defined by
|
26
|
+
# Metadata::Row_type. The ith element
|
27
|
+
# in each row matches the ith field in
|
28
|
+
# Metadata::Row_type. Elements are
|
29
|
+
# encoded based on type as described
|
30
|
+
# Here.
|
31
|
+
# @!attribute [rw] stats
|
32
|
+
# @return [Google::Spanner::V1::ResultSetStats]
|
33
|
+
# Query plan and execution statistics for the query that produced this
|
34
|
+
# result set. These can be requested by setting
|
35
|
+
# ExecuteSqlRequest#query_mode.
|
36
|
+
class ResultSet; end
|
37
|
+
|
38
|
+
# Partial results from a streaming read or SQL query. Streaming reads and
|
39
|
+
# SQL queries better tolerate large result sets, large rows, and large
|
40
|
+
# values, but are a little trickier to consume.
|
41
|
+
# @!attribute [rw] metadata
|
42
|
+
# @return [Google::Spanner::V1::ResultSetMetadata]
|
43
|
+
# Metadata about the result set, such as row type information.
|
44
|
+
# Only present in the first response.
|
45
|
+
# @!attribute [rw] values
|
46
|
+
# @return [Array<Google::Protobuf::Value>]
|
47
|
+
# A streamed result set consists of a stream of values, which might
|
48
|
+
# be split into many +PartialResultSet+ messages to accommodate
|
49
|
+
# large rows and/or large values. Every N complete values defines a
|
50
|
+
# row, where N is equal to the number of entries in
|
51
|
+
# Metadata::Row_type::Fields.
|
52
|
+
#
|
53
|
+
# Most values are encoded based on type as described
|
54
|
+
# Here.
|
55
|
+
#
|
56
|
+
# It is possible that the last value in values is "chunked",
|
57
|
+
# meaning that the rest of the value is sent in subsequent
|
58
|
+
# +PartialResultSet+(s). This is denoted by the Chunked_value
|
59
|
+
# field. Two or more chunked values can be merged to form a
|
60
|
+
# complete value as follows:
|
61
|
+
#
|
62
|
+
# * +bool/number/null+: cannot be chunked
|
63
|
+
# * +string+: concatenate the strings
|
64
|
+
# * +list+: concatenate the lists. If the last element in a list is a
|
65
|
+
# +string+, +list+, or +object+, merge it with the first element in
|
66
|
+
# the next list by applying these rules recursively.
|
67
|
+
# * +object+: concatenate the (field name, field value) pairs. If a
|
68
|
+
# field name is duplicated, then apply these rules recursively
|
69
|
+
# to merge the field values.
|
70
|
+
#
|
71
|
+
# Some examples of merging:
|
72
|
+
#
|
73
|
+
# # Strings are concatenated.
|
74
|
+
# "foo", "bar" => "foobar"
|
75
|
+
#
|
76
|
+
# # Lists of non-strings are concatenated.
|
77
|
+
# [2, 3], [4] => [2, 3, 4]
|
78
|
+
#
|
79
|
+
# # Lists are concatenated, but the last and first elements are merged
|
80
|
+
# # because they are strings.
|
81
|
+
# ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
|
82
|
+
#
|
83
|
+
# # Lists are concatenated, but the last and first elements are merged
|
84
|
+
# # because they are lists. Recursively, the last and first elements
|
85
|
+
# # of the inner lists are merged because they are strings.
|
86
|
+
# ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
|
87
|
+
#
|
88
|
+
# # Non-overlapping object fields are combined.
|
89
|
+
# {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
|
90
|
+
#
|
91
|
+
# # Overlapping object fields are merged.
|
92
|
+
# {"a": "1"}, {"a": "2"} => {"a": "12"}
|
93
|
+
#
|
94
|
+
# # Examples of merging objects containing lists of strings.
|
95
|
+
# {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
|
96
|
+
#
|
97
|
+
# For a more complete example, suppose a streaming SQL query is
|
98
|
+
# yielding a result set whose rows contain a single string
|
99
|
+
# field. The following +PartialResultSet+s might be yielded:
|
100
|
+
#
|
101
|
+
# {
|
102
|
+
# "metadata": { ... }
|
103
|
+
# "values": ["Hello", "W"]
|
104
|
+
# "chunked_value": true
|
105
|
+
# "resume_token": "Af65..."
|
106
|
+
# }
|
107
|
+
# {
|
108
|
+
# "values": ["orl"]
|
109
|
+
# "chunked_value": true
|
110
|
+
# "resume_token": "Bqp2..."
|
111
|
+
# }
|
112
|
+
# {
|
113
|
+
# "values": ["d"]
|
114
|
+
# "resume_token": "Zx1B..."
|
115
|
+
# }
|
116
|
+
#
|
117
|
+
# This sequence of +PartialResultSet+s encodes two rows, one
|
118
|
+
# containing the field value +"Hello"+, and a second containing the
|
119
|
+
# field value +"World" = "W" + "orl" + "d"+.
|
120
|
+
# @!attribute [rw] chunked_value
|
121
|
+
# @return [true, false]
|
122
|
+
# If true, then the final value in Values is chunked, and must
|
123
|
+
# be combined with more values from subsequent +PartialResultSet+s
|
124
|
+
# to obtain a complete field value.
|
125
|
+
# @!attribute [rw] resume_token
|
126
|
+
# @return [String]
|
127
|
+
# Streaming calls might be interrupted for a variety of reasons, such
|
128
|
+
# as TCP connection loss. If this occurs, the stream of results can
|
129
|
+
# be resumed by re-sending the original request and including
|
130
|
+
# +resume_token+. Note that executing any other transaction in the
|
131
|
+
# same session invalidates the token.
|
132
|
+
# @!attribute [rw] stats
|
133
|
+
# @return [Google::Spanner::V1::ResultSetStats]
|
134
|
+
# Query plan and execution statistics for the query that produced this
|
135
|
+
# streaming result set. These can be requested by setting
|
136
|
+
# ExecuteSqlRequest#query_mode and are sent
|
137
|
+
# only once with the last response in the stream.
|
138
|
+
class PartialResultSet; end
|
139
|
+
|
140
|
+
# Metadata about a ResultSet or PartialResultSet.
|
141
|
+
# @!attribute [rw] row_type
|
142
|
+
# @return [Google::Spanner::V1::StructType]
|
143
|
+
# Indicates the field names and types for the rows in the result
|
144
|
+
# set. For example, a SQL query like +"SELECT UserId, UserName FROM
|
145
|
+
# Users"+ could return a +row_type+ value like:
|
146
|
+
#
|
147
|
+
# "fields": [
|
148
|
+
# { "name": "UserId", "type": { "code": "INT64" } },
|
149
|
+
# { "name": "UserName", "type": { "code": "STRING" } },
|
150
|
+
# ]
|
151
|
+
# @!attribute [rw] transaction
|
152
|
+
# @return [Google::Spanner::V1::Transaction]
|
153
|
+
# If the read or SQL query began a transaction as a side-effect, the
|
154
|
+
# information about the new transaction is yielded here.
|
155
|
+
class ResultSetMetadata; end
|
156
|
+
|
157
|
+
# Additional statistics about a ResultSet or PartialResultSet.
|
158
|
+
# @!attribute [rw] query_plan
|
159
|
+
# @return [Google::Spanner::V1::QueryPlan]
|
160
|
+
# QueryPlan for the query associated with this result.
|
161
|
+
# @!attribute [rw] query_stats
|
162
|
+
# @return [Google::Protobuf::Struct]
|
163
|
+
# Aggregated statistics from the execution of the query. Only present when
|
164
|
+
# the query is profiled. For example, a query could return the statistics as
|
165
|
+
# follows:
|
166
|
+
#
|
167
|
+
# {
|
168
|
+
# "rows_returned": "3",
|
169
|
+
# "elapsed_time": "1.22 secs",
|
170
|
+
# "cpu_time": "1.19 secs"
|
171
|
+
# }
|
172
|
+
class ResultSetStats; end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
module Google
|
16
|
+
module Spanner
|
17
|
+
module V1
|
18
|
+
# The request for CreateSession.
|
19
|
+
# @!attribute [rw] database
|
20
|
+
# @return [String]
|
21
|
+
# Required. The database in which the new session is created.
|
22
|
+
class CreateSessionRequest; end
|
23
|
+
|
24
|
+
# A session in the Cloud Spanner API.
|
25
|
+
# @!attribute [rw] name
|
26
|
+
# @return [String]
|
27
|
+
# Required. The name of the session.
|
28
|
+
class Session; end
|
29
|
+
|
30
|
+
# The request for GetSession.
|
31
|
+
# @!attribute [rw] name
|
32
|
+
# @return [String]
|
33
|
+
# Required. The name of the session to retrieve.
|
34
|
+
class GetSessionRequest; end
|
35
|
+
|
36
|
+
# The request for DeleteSession.
|
37
|
+
# @!attribute [rw] name
|
38
|
+
# @return [String]
|
39
|
+
# Required. The name of the session to delete.
|
40
|
+
class DeleteSessionRequest; end
|
41
|
+
|
42
|
+
# The request for ExecuteSql and
|
43
|
+
# ExecuteStreamingSql.
|
44
|
+
# @!attribute [rw] session
|
45
|
+
# @return [String]
|
46
|
+
# Required. The session in which the SQL query should be performed.
|
47
|
+
# @!attribute [rw] transaction
|
48
|
+
# @return [Google::Spanner::V1::TransactionSelector]
|
49
|
+
# The transaction to use. If none is provided, the default is a
|
50
|
+
# temporary read-only transaction with strong concurrency.
|
51
|
+
# @!attribute [rw] sql
|
52
|
+
# @return [String]
|
53
|
+
# Required. The SQL query string.
|
54
|
+
# @!attribute [rw] params
|
55
|
+
# @return [Google::Protobuf::Struct]
|
56
|
+
# The SQL query string can contain parameter placeholders. A parameter
|
57
|
+
# placeholder consists of +'@'+ followed by the parameter
|
58
|
+
# name. Parameter names consist of any combination of letters,
|
59
|
+
# numbers, and underscores.
|
60
|
+
#
|
61
|
+
# Parameters can appear anywhere that a literal value is expected. The same
|
62
|
+
# parameter name can be used more than once, for example:
|
63
|
+
# +"WHERE id > @msg_id AND id < @msg_id + 100"+
|
64
|
+
#
|
65
|
+
# It is an error to execute an SQL query with unbound parameters.
|
66
|
+
#
|
67
|
+
# Parameter values are specified using +params+, which is a JSON
|
68
|
+
# object whose keys are parameter names, and whose values are the
|
69
|
+
# corresponding parameter values.
|
70
|
+
# @!attribute [rw] param_types
|
71
|
+
# @return [Hash{String => Google::Spanner::V1::Type}]
|
72
|
+
# It is not always possible for Cloud Spanner to infer the right SQL type
|
73
|
+
# from a JSON value. For example, values of type +BYTES+ and values
|
74
|
+
# of type +STRING+ both appear in Params as JSON strings.
|
75
|
+
#
|
76
|
+
# In these cases, +param_types+ can be used to specify the exact
|
77
|
+
# SQL type for some or all of the SQL query parameters. See the
|
78
|
+
# definition of Type for more information
|
79
|
+
# about SQL types.
|
80
|
+
# @!attribute [rw] resume_token
|
81
|
+
# @return [String]
|
82
|
+
# If this request is resuming a previously interrupted SQL query
|
83
|
+
# execution, +resume_token+ should be copied from the last
|
84
|
+
# PartialResultSet yielded before the interruption. Doing this
|
85
|
+
# enables the new SQL query execution to resume where the last one left
|
86
|
+
# off. The rest of the request parameters must exactly match the
|
87
|
+
# request that yielded this token.
|
88
|
+
# @!attribute [rw] query_mode
|
89
|
+
# @return [Google::Spanner::V1::ExecuteSqlRequest::QueryMode]
|
90
|
+
# Used to control the amount of debugging information returned in
|
91
|
+
# ResultSetStats.
|
92
|
+
class ExecuteSqlRequest
|
93
|
+
# Mode in which the query must be processed.
|
94
|
+
module QueryMode
|
95
|
+
# The default mode where only the query result, without any information
|
96
|
+
# about the query plan is returned.
|
97
|
+
NORMAL = 0
|
98
|
+
|
99
|
+
# This mode returns only the query plan, without any result rows or
|
100
|
+
# execution statistics information.
|
101
|
+
PLAN = 1
|
102
|
+
|
103
|
+
# This mode returns both the query plan and the execution statistics along
|
104
|
+
# with the result rows.
|
105
|
+
PROFILE = 2
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# The request for Read and
|
110
|
+
# StreamingRead.
|
111
|
+
# @!attribute [rw] session
|
112
|
+
# @return [String]
|
113
|
+
# Required. The session in which the read should be performed.
|
114
|
+
# @!attribute [rw] transaction
|
115
|
+
# @return [Google::Spanner::V1::TransactionSelector]
|
116
|
+
# The transaction to use. If none is provided, the default is a
|
117
|
+
# temporary read-only transaction with strong concurrency.
|
118
|
+
# @!attribute [rw] table
|
119
|
+
# @return [String]
|
120
|
+
# Required. The name of the table in the database to be read.
|
121
|
+
# @!attribute [rw] index
|
122
|
+
# @return [String]
|
123
|
+
# If non-empty, the name of an index on Table. This index is
|
124
|
+
# used instead of the table primary key when interpreting Key_set
|
125
|
+
# and sorting result rows. See Key_set for further information.
|
126
|
+
# @!attribute [rw] columns
|
127
|
+
# @return [Array<String>]
|
128
|
+
# The columns of Table to be returned for each row matching
|
129
|
+
# this request.
|
130
|
+
# @!attribute [rw] key_set
|
131
|
+
# @return [Google::Spanner::V1::KeySet]
|
132
|
+
# Required. +key_set+ identifies the rows to be yielded. +key_set+ names the
|
133
|
+
# primary keys of the rows in Table to be yielded, unless Index
|
134
|
+
# is present. If Index is present, then Key_set instead names
|
135
|
+
# index keys in Index.
|
136
|
+
#
|
137
|
+
# Rows are yielded in table primary key order (if Index is empty)
|
138
|
+
# or index key order (if Index is non-empty).
|
139
|
+
#
|
140
|
+
# It is not an error for the +key_set+ to name rows that do not
|
141
|
+
# exist in the database. Read yields nothing for nonexistent rows.
|
142
|
+
# @!attribute [rw] limit
|
143
|
+
# @return [Integer]
|
144
|
+
# If greater than zero, only the first +limit+ rows are yielded. If +limit+
|
145
|
+
# is zero, the default is no limit.
|
146
|
+
# @!attribute [rw] resume_token
|
147
|
+
# @return [String]
|
148
|
+
# If this request is resuming a previously interrupted read,
|
149
|
+
# +resume_token+ should be copied from the last
|
150
|
+
# PartialResultSet yielded before the interruption. Doing this
|
151
|
+
# enables the new read to resume where the last read left off. The
|
152
|
+
# rest of the request parameters must exactly match the request
|
153
|
+
# that yielded this token.
|
154
|
+
class ReadRequest; end
|
155
|
+
|
156
|
+
# The request for BeginTransaction.
|
157
|
+
# @!attribute [rw] session
|
158
|
+
# @return [String]
|
159
|
+
# Required. The session in which the transaction runs.
|
160
|
+
# @!attribute [rw] options
|
161
|
+
# @return [Google::Spanner::V1::TransactionOptions]
|
162
|
+
# Required. Options for the new transaction.
|
163
|
+
class BeginTransactionRequest; end
|
164
|
+
|
165
|
+
# The request for Commit.
|
166
|
+
# @!attribute [rw] session
|
167
|
+
# @return [String]
|
168
|
+
# Required. The session in which the transaction to be committed is running.
|
169
|
+
# @!attribute [rw] transaction_id
|
170
|
+
# @return [String]
|
171
|
+
# Commit a previously-started transaction.
|
172
|
+
# @!attribute [rw] single_use_transaction
|
173
|
+
# @return [Google::Spanner::V1::TransactionOptions]
|
174
|
+
# Execute mutations in a temporary transaction. Note that unlike
|
175
|
+
# commit of a previously-started transaction, commit with a
|
176
|
+
# temporary transaction is non-idempotent. That is, if the
|
177
|
+
# +CommitRequest+ is sent to Cloud Spanner more than once (for
|
178
|
+
# instance, due to retries in the application, or in the
|
179
|
+
# transport library), it is possible that the mutations are
|
180
|
+
# executed more than once. If this is undesirable, use
|
181
|
+
# BeginTransaction and
|
182
|
+
# Commit instead.
|
183
|
+
# @!attribute [rw] mutations
|
184
|
+
# @return [Array<Google::Spanner::V1::Mutation>]
|
185
|
+
# The mutations to be executed when this transaction commits. All
|
186
|
+
# mutations are applied atomically, in the order they appear in
|
187
|
+
# this list.
|
188
|
+
class CommitRequest; end
|
189
|
+
|
190
|
+
# The response for Commit.
|
191
|
+
# @!attribute [rw] commit_timestamp
|
192
|
+
# @return [Google::Protobuf::Timestamp]
|
193
|
+
# The Cloud Spanner timestamp at which the transaction committed.
|
194
|
+
class CommitResponse; end
|
195
|
+
|
196
|
+
# The request for Rollback.
|
197
|
+
# @!attribute [rw] session
|
198
|
+
# @return [String]
|
199
|
+
# Required. The session in which the transaction to roll back is running.
|
200
|
+
# @!attribute [rw] transaction_id
|
201
|
+
# @return [String]
|
202
|
+
# Required. The transaction to roll back.
|
203
|
+
class RollbackRequest; end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|