@google-cloud/spanner-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +80 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/location.proto +388 -0
- package/build/protos/google/spanner/v1/mutation.proto +156 -0
- package/build/protos/google/spanner/v1/query_plan.proto +156 -0
- package/build/protos/google/spanner/v1/result_set.proto +260 -0
- package/build/protos/google/spanner/v1/spanner.proto +1472 -0
- package/build/protos/google/spanner/v1/transaction.proto +329 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +42547 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/database_admin_client.d.ts +2433 -0
- package/build/src/v1/database_admin_client.js +2938 -0
- package/build/src/v1/database_admin_client.js.map +1 -0
- package/build/src/v1/database_admin_client_config.json +169 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +253 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/instance_admin_client.d.ts +2162 -0
- package/build/src/v1/instance_admin_client.js +2411 -0
- package/build/src/v1/instance_admin_client.js.map +1 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1353 -0
- package/build/src/v1/spanner_client.js +1456 -0
- package/build/src/v1/spanner_client.js.map +1 -0
- package/build/src/v1/spanner_client_config.json +123 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
- package/build/src/v1/spanner_executor_proxy_client.js +730 -0
- package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
- package/build/src/v1/spanner_proto_list.json +12 -0
- package/package.json +65 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
20
|
+
import "google/protobuf/struct.proto";
|
|
21
|
+
import "google/protobuf/timestamp.proto";
|
|
22
|
+
import "google/spanner/v1/keys.proto";
|
|
23
|
+
|
|
24
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
25
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
26
|
+
option java_multiple_files = true;
|
|
27
|
+
option java_outer_classname = "MutationProto";
|
|
28
|
+
option java_package = "com.google.spanner.v1";
|
|
29
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
30
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
31
|
+
|
|
32
|
+
// A modification to one or more Cloud Spanner rows. Mutations can be
|
|
33
|
+
// applied to a Cloud Spanner database by sending them in a
|
|
34
|
+
// [Commit][google.spanner.v1.Spanner.Commit] call.
|
|
35
|
+
message Mutation {
|
|
36
|
+
// Arguments to [insert][google.spanner.v1.Mutation.insert],
|
|
37
|
+
// [update][google.spanner.v1.Mutation.update],
|
|
38
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], and
|
|
39
|
+
// [replace][google.spanner.v1.Mutation.replace] operations.
|
|
40
|
+
message Write {
|
|
41
|
+
// Required. The table whose rows will be written.
|
|
42
|
+
string table = 1 [(google.api.field_behavior) = REQUIRED];
|
|
43
|
+
|
|
44
|
+
// The names of the columns in
|
|
45
|
+
// [table][google.spanner.v1.Mutation.Write.table] to be written.
|
|
46
|
+
//
|
|
47
|
+
// The list of columns must contain enough columns to allow
|
|
48
|
+
// Cloud Spanner to derive values for all primary key columns in the
|
|
49
|
+
// row(s) to be modified.
|
|
50
|
+
repeated string columns = 2;
|
|
51
|
+
|
|
52
|
+
// The values to be written. `values` can contain more than one
|
|
53
|
+
// list of values. If it does, then multiple rows are written, one
|
|
54
|
+
// for each entry in `values`. Each list in `values` must have
|
|
55
|
+
// exactly as many entries as there are entries in
|
|
56
|
+
// [columns][google.spanner.v1.Mutation.Write.columns] above. Sending
|
|
57
|
+
// multiple lists is equivalent to sending multiple `Mutation`s, each
|
|
58
|
+
// containing one `values` entry and repeating
|
|
59
|
+
// [table][google.spanner.v1.Mutation.Write.table] and
|
|
60
|
+
// [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in
|
|
61
|
+
// each list are encoded as described [here][google.spanner.v1.TypeCode].
|
|
62
|
+
repeated google.protobuf.ListValue values = 3;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Arguments to [delete][google.spanner.v1.Mutation.delete] operations.
|
|
66
|
+
message Delete {
|
|
67
|
+
// Required. The table whose rows will be deleted.
|
|
68
|
+
string table = 1 [(google.api.field_behavior) = REQUIRED];
|
|
69
|
+
|
|
70
|
+
// Required. The primary keys of the rows within
|
|
71
|
+
// [table][google.spanner.v1.Mutation.Delete.table] to delete. The primary
|
|
72
|
+
// keys must be specified in the order in which they appear in the `PRIMARY
|
|
73
|
+
// KEY()` clause of the table's equivalent DDL statement (the DDL statement
|
|
74
|
+
// used to create the table). Delete is idempotent. The transaction will
|
|
75
|
+
// succeed even if some or all rows do not exist.
|
|
76
|
+
KeySet key_set = 2 [(google.api.field_behavior) = REQUIRED];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Arguments to [send][google.spanner.v1.Mutation.send] operations.
|
|
80
|
+
message Send {
|
|
81
|
+
// Required. The queue to which the message will be sent.
|
|
82
|
+
string queue = 1 [(google.api.field_behavior) = REQUIRED];
|
|
83
|
+
|
|
84
|
+
// Required. The primary key of the message to be sent.
|
|
85
|
+
google.protobuf.ListValue key = 2 [(google.api.field_behavior) = REQUIRED];
|
|
86
|
+
|
|
87
|
+
// The time at which Spanner will begin attempting to deliver the message.
|
|
88
|
+
// If `deliver_time` is not set, Spanner will deliver the message
|
|
89
|
+
// immediately. If `deliver_time` is in the past, Spanner will replace it
|
|
90
|
+
// with a value closer to the current time.
|
|
91
|
+
google.protobuf.Timestamp deliver_time = 3;
|
|
92
|
+
|
|
93
|
+
// The payload of the message.
|
|
94
|
+
google.protobuf.Value payload = 4;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Arguments to [ack][google.spanner.v1.Mutation.ack] operations.
|
|
98
|
+
message Ack {
|
|
99
|
+
// Required. The queue where the message to be acked is stored.
|
|
100
|
+
string queue = 1 [(google.api.field_behavior) = REQUIRED];
|
|
101
|
+
|
|
102
|
+
// Required. The primary key of the message to be acked.
|
|
103
|
+
google.protobuf.ListValue key = 2 [(google.api.field_behavior) = REQUIRED];
|
|
104
|
+
|
|
105
|
+
// By default, an attempt to ack a message that does not exist will fail
|
|
106
|
+
// with a `NOT_FOUND` error. With `ignore_not_found` set to true, the ack
|
|
107
|
+
// will succeed even if the message does not exist. This is useful for
|
|
108
|
+
// unconditionally acking a message, even if it is missing or has already
|
|
109
|
+
// been acked.
|
|
110
|
+
bool ignore_not_found = 3;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Required. The operation to perform.
|
|
114
|
+
oneof operation {
|
|
115
|
+
// Insert new rows in a table. If any of the rows already exist,
|
|
116
|
+
// the write or transaction fails with error `ALREADY_EXISTS`.
|
|
117
|
+
Write insert = 1;
|
|
118
|
+
|
|
119
|
+
// Update existing rows in a table. If any of the rows does not
|
|
120
|
+
// already exist, the transaction fails with error `NOT_FOUND`.
|
|
121
|
+
Write update = 2;
|
|
122
|
+
|
|
123
|
+
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
124
|
+
// already exists, then its column values are overwritten with the ones
|
|
125
|
+
// provided. Any column values not explicitly written are preserved.
|
|
126
|
+
//
|
|
127
|
+
// When using
|
|
128
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as
|
|
129
|
+
// when using [insert][google.spanner.v1.Mutation.insert], all `NOT NULL`
|
|
130
|
+
// columns in the table must be given a value. This holds true even when the
|
|
131
|
+
// row already exists and will therefore actually be updated.
|
|
132
|
+
Write insert_or_update = 3;
|
|
133
|
+
|
|
134
|
+
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
135
|
+
// already exists, it is deleted, and the column values provided are
|
|
136
|
+
// inserted instead. Unlike
|
|
137
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this
|
|
138
|
+
// means any values not explicitly written become `NULL`.
|
|
139
|
+
//
|
|
140
|
+
// In an interleaved table, if you create the child table with the
|
|
141
|
+
// `ON DELETE CASCADE` annotation, then replacing a parent row
|
|
142
|
+
// also deletes the child rows. Otherwise, you must delete the
|
|
143
|
+
// child rows before you replace the parent row.
|
|
144
|
+
Write replace = 4;
|
|
145
|
+
|
|
146
|
+
// Delete rows from a table. Succeeds whether or not the named
|
|
147
|
+
// rows were present.
|
|
148
|
+
Delete delete = 5;
|
|
149
|
+
|
|
150
|
+
// Send a message to a queue.
|
|
151
|
+
Send send = 6;
|
|
152
|
+
|
|
153
|
+
// Ack a message from a queue.
|
|
154
|
+
Ack ack = 7;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
20
|
+
import "google/protobuf/struct.proto";
|
|
21
|
+
|
|
22
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
23
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
24
|
+
option java_multiple_files = true;
|
|
25
|
+
option java_outer_classname = "QueryPlanProto";
|
|
26
|
+
option java_package = "com.google.spanner.v1";
|
|
27
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
28
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
29
|
+
|
|
30
|
+
// Node information for nodes appearing in a
|
|
31
|
+
// [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].
|
|
32
|
+
message PlanNode {
|
|
33
|
+
// The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between
|
|
34
|
+
// the two different kinds of nodes that can appear in a query plan.
|
|
35
|
+
enum Kind {
|
|
36
|
+
// Not specified.
|
|
37
|
+
KIND_UNSPECIFIED = 0;
|
|
38
|
+
|
|
39
|
+
// Denotes a Relational operator node in the expression tree. Relational
|
|
40
|
+
// operators represent iterative processing of rows during query execution.
|
|
41
|
+
// For example, a `TableScan` operation that reads rows from a table.
|
|
42
|
+
RELATIONAL = 1;
|
|
43
|
+
|
|
44
|
+
// Denotes a Scalar node in the expression tree. Scalar nodes represent
|
|
45
|
+
// non-iterable entities in the query plan. For example, constants or
|
|
46
|
+
// arithmetic operators appearing inside predicate expressions or references
|
|
47
|
+
// to column names.
|
|
48
|
+
SCALAR = 2;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Metadata associated with a parent-child relationship appearing in a
|
|
52
|
+
// [PlanNode][google.spanner.v1.PlanNode].
|
|
53
|
+
message ChildLink {
|
|
54
|
+
// The node to which the link points.
|
|
55
|
+
int32 child_index = 1;
|
|
56
|
+
|
|
57
|
+
// The type of the link. For example, in Hash Joins this could be used to
|
|
58
|
+
// distinguish between the build child and the probe child, or in the case
|
|
59
|
+
// of the child being an output variable, to represent the tag associated
|
|
60
|
+
// with the output variable.
|
|
61
|
+
string type = 2;
|
|
62
|
+
|
|
63
|
+
// Only present if the child node is
|
|
64
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds to an
|
|
65
|
+
// output variable of the parent node. The field carries the name of the
|
|
66
|
+
// output variable. For example, a `TableScan` operator that reads rows from
|
|
67
|
+
// a table will have child links to the `SCALAR` nodes representing the
|
|
68
|
+
// output variables created for each column that is read by the operator.
|
|
69
|
+
// The corresponding `variable` fields will be set to the variable names
|
|
70
|
+
// assigned to the columns.
|
|
71
|
+
string variable = 3;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Condensed representation of a node and its subtree. Only present for
|
|
75
|
+
// `SCALAR` [PlanNode(s)][google.spanner.v1.PlanNode].
|
|
76
|
+
message ShortRepresentation {
|
|
77
|
+
// A string representation of the expression subtree rooted at this node.
|
|
78
|
+
string description = 1;
|
|
79
|
+
|
|
80
|
+
// A mapping of (subquery variable name) -> (subquery node id) for cases
|
|
81
|
+
// where the `description` string of this node references a `SCALAR`
|
|
82
|
+
// subquery contained in the expression subtree rooted at this node. The
|
|
83
|
+
// referenced `SCALAR` subquery may not necessarily be a direct child of
|
|
84
|
+
// this node.
|
|
85
|
+
map<string, int32> subqueries = 2;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The `PlanNode`'s index in [node
|
|
89
|
+
// list][google.spanner.v1.QueryPlan.plan_nodes].
|
|
90
|
+
int32 index = 1;
|
|
91
|
+
|
|
92
|
+
// Used to determine the type of node. May be needed for visualizing
|
|
93
|
+
// different kinds of nodes differently. For example, If the node is a
|
|
94
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a
|
|
95
|
+
// condensed representation which can be used to directly embed a description
|
|
96
|
+
// of the node in its parent.
|
|
97
|
+
Kind kind = 2;
|
|
98
|
+
|
|
99
|
+
// The display name for the node.
|
|
100
|
+
string display_name = 3;
|
|
101
|
+
|
|
102
|
+
// List of child node `index`es and their relationship to this parent.
|
|
103
|
+
repeated ChildLink child_links = 4;
|
|
104
|
+
|
|
105
|
+
// Condensed representation for
|
|
106
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes.
|
|
107
|
+
ShortRepresentation short_representation = 5;
|
|
108
|
+
|
|
109
|
+
// Attributes relevant to the node contained in a group of key-value pairs.
|
|
110
|
+
// For example, a Parameter Reference node could have the following
|
|
111
|
+
// information in its metadata:
|
|
112
|
+
//
|
|
113
|
+
// {
|
|
114
|
+
// "parameter_reference": "param1",
|
|
115
|
+
// "parameter_type": "array"
|
|
116
|
+
// }
|
|
117
|
+
google.protobuf.Struct metadata = 6;
|
|
118
|
+
|
|
119
|
+
// The execution statistics associated with the node, contained in a group of
|
|
120
|
+
// key-value pairs. Only present if the plan was returned as a result of a
|
|
121
|
+
// profile query. For example, number of executions, number of rows/time per
|
|
122
|
+
// execution etc.
|
|
123
|
+
google.protobuf.Struct execution_stats = 7;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Output of query advisor analysis.
|
|
127
|
+
message QueryAdvisorResult {
|
|
128
|
+
// Recommendation to add new indexes to run queries more efficiently.
|
|
129
|
+
message IndexAdvice {
|
|
130
|
+
// Optional. DDL statements to add new indexes that will improve the query.
|
|
131
|
+
repeated string ddl = 1 [(google.api.field_behavior) = OPTIONAL];
|
|
132
|
+
|
|
133
|
+
// Optional. Estimated latency improvement factor. For example if the query
|
|
134
|
+
// currently takes 500 ms to run and the estimated latency with new indexes
|
|
135
|
+
// is 100 ms this field will be 5.
|
|
136
|
+
double improvement_factor = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Optional. Index Recommendation for a query. This is an optional field and
|
|
140
|
+
// the recommendation will only be available when the recommendation
|
|
141
|
+
// guarantees significant improvement in query performance.
|
|
142
|
+
repeated IndexAdvice index_advice = 1
|
|
143
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Contains an ordered list of nodes appearing in the query plan.
|
|
147
|
+
message QueryPlan {
|
|
148
|
+
// The nodes in the query plan. Plan nodes are returned in pre-order starting
|
|
149
|
+
// with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id`
|
|
150
|
+
// corresponds to its index in `plan_nodes`.
|
|
151
|
+
repeated PlanNode plan_nodes = 1;
|
|
152
|
+
|
|
153
|
+
// Optional. The advise/recommendations for a query. Currently this field will
|
|
154
|
+
// be serving index recommendations for a query.
|
|
155
|
+
QueryAdvisorResult query_advice = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
156
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
20
|
+
import "google/protobuf/struct.proto";
|
|
21
|
+
import "google/spanner/v1/location.proto";
|
|
22
|
+
import "google/spanner/v1/query_plan.proto";
|
|
23
|
+
import "google/spanner/v1/transaction.proto";
|
|
24
|
+
import "google/spanner/v1/type.proto";
|
|
25
|
+
|
|
26
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
27
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
28
|
+
option java_multiple_files = true;
|
|
29
|
+
option java_outer_classname = "ResultSetProto";
|
|
30
|
+
option java_package = "com.google.spanner.v1";
|
|
31
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
32
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
33
|
+
|
|
34
|
+
// Results from [Read][google.spanner.v1.Spanner.Read] or
|
|
35
|
+
// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
|
|
36
|
+
message ResultSet {
|
|
37
|
+
// Metadata about the result set, such as row type information.
|
|
38
|
+
ResultSetMetadata metadata = 1;
|
|
39
|
+
|
|
40
|
+
// Each element in `rows` is a row whose format is defined by
|
|
41
|
+
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith
|
|
42
|
+
// element in each row matches the ith field in
|
|
43
|
+
// [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements
|
|
44
|
+
// are encoded based on type as described [here][google.spanner.v1.TypeCode].
|
|
45
|
+
repeated google.protobuf.ListValue rows = 2;
|
|
46
|
+
|
|
47
|
+
// Query plan and execution statistics for the SQL statement that
|
|
48
|
+
// produced this result set. These can be requested by setting
|
|
49
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
50
|
+
// DML statements always produce stats containing the number of rows
|
|
51
|
+
// modified, unless executed using the
|
|
52
|
+
// [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN]
|
|
53
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
54
|
+
// Other fields might or might not be populated, based on the
|
|
55
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
|
|
56
|
+
ResultSetStats stats = 3;
|
|
57
|
+
|
|
58
|
+
// Optional. A precommit token is included if the read-write transaction is on
|
|
59
|
+
// a multiplexed session. Pass the precommit token with the highest sequence
|
|
60
|
+
// number from this transaction attempt to the
|
|
61
|
+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
|
|
62
|
+
MultiplexedSessionPrecommitToken precommit_token = 5
|
|
63
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
64
|
+
|
|
65
|
+
// Optional. A cache update expresses a set of changes the client should
|
|
66
|
+
// incorporate into its location cache. The client should discard the changes
|
|
67
|
+
// if they are older than the data it already has. This data can be obtained
|
|
68
|
+
// in response to requests that included a `RoutingHint` field, but may also
|
|
69
|
+
// be obtained by explicit location-fetching RPCs which may be added in the
|
|
70
|
+
// future.
|
|
71
|
+
CacheUpdate cache_update = 6 [(google.api.field_behavior) = OPTIONAL];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Partial results from a streaming read or SQL query. Streaming reads and
|
|
75
|
+
// SQL queries better tolerate large result sets, large rows, and large
|
|
76
|
+
// values, but are a little trickier to consume.
|
|
77
|
+
message PartialResultSet {
|
|
78
|
+
// Metadata about the result set, such as row type information.
|
|
79
|
+
// Only present in the first response.
|
|
80
|
+
ResultSetMetadata metadata = 1;
|
|
81
|
+
|
|
82
|
+
// A streamed result set consists of a stream of values, which might
|
|
83
|
+
// be split into many `PartialResultSet` messages to accommodate
|
|
84
|
+
// large rows and/or large values. Every N complete values defines a
|
|
85
|
+
// row, where N is equal to the number of entries in
|
|
86
|
+
// [metadata.row_type.fields][google.spanner.v1.StructType.fields].
|
|
87
|
+
//
|
|
88
|
+
// Most values are encoded based on type as described
|
|
89
|
+
// [here][google.spanner.v1.TypeCode].
|
|
90
|
+
//
|
|
91
|
+
// It's possible that the last value in values is "chunked",
|
|
92
|
+
// meaning that the rest of the value is sent in subsequent
|
|
93
|
+
// `PartialResultSet`(s). This is denoted by the
|
|
94
|
+
// [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] field.
|
|
95
|
+
// Two or more chunked values can be merged to form a complete value as
|
|
96
|
+
// follows:
|
|
97
|
+
//
|
|
98
|
+
// * `bool/number/null`: can't be chunked
|
|
99
|
+
// * `string`: concatenate the strings
|
|
100
|
+
// * `list`: concatenate the lists. If the last element in a list is a
|
|
101
|
+
// `string`, `list`, or `object`, merge it with the first element in
|
|
102
|
+
// the next list by applying these rules recursively.
|
|
103
|
+
// * `object`: concatenate the (field name, field value) pairs. If a
|
|
104
|
+
// field name is duplicated, then apply these rules recursively
|
|
105
|
+
// to merge the field values.
|
|
106
|
+
//
|
|
107
|
+
// Some examples of merging:
|
|
108
|
+
//
|
|
109
|
+
// Strings are concatenated.
|
|
110
|
+
// "foo", "bar" => "foobar"
|
|
111
|
+
//
|
|
112
|
+
// Lists of non-strings are concatenated.
|
|
113
|
+
// [2, 3], [4] => [2, 3, 4]
|
|
114
|
+
//
|
|
115
|
+
// Lists are concatenated, but the last and first elements are merged
|
|
116
|
+
// because they are strings.
|
|
117
|
+
// ["a", "b"], ["c", "d"] => ["a", "bc", "d"]
|
|
118
|
+
//
|
|
119
|
+
// Lists are concatenated, but the last and first elements are merged
|
|
120
|
+
// because they are lists. Recursively, the last and first elements
|
|
121
|
+
// of the inner lists are merged because they are strings.
|
|
122
|
+
// ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
|
|
123
|
+
//
|
|
124
|
+
// Non-overlapping object fields are combined.
|
|
125
|
+
// {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
|
|
126
|
+
//
|
|
127
|
+
// Overlapping object fields are merged.
|
|
128
|
+
// {"a": "1"}, {"a": "2"} => {"a": "12"}
|
|
129
|
+
//
|
|
130
|
+
// Examples of merging objects containing lists of strings.
|
|
131
|
+
// {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
|
|
132
|
+
//
|
|
133
|
+
// For a more complete example, suppose a streaming SQL query is
|
|
134
|
+
// yielding a result set whose rows contain a single string
|
|
135
|
+
// field. The following `PartialResultSet`s might be yielded:
|
|
136
|
+
//
|
|
137
|
+
// {
|
|
138
|
+
// "metadata": { ... }
|
|
139
|
+
// "values": ["Hello", "W"]
|
|
140
|
+
// "chunked_value": true
|
|
141
|
+
// "resume_token": "Af65..."
|
|
142
|
+
// }
|
|
143
|
+
// {
|
|
144
|
+
// "values": ["orl"]
|
|
145
|
+
// "chunked_value": true
|
|
146
|
+
// }
|
|
147
|
+
// {
|
|
148
|
+
// "values": ["d"]
|
|
149
|
+
// "resume_token": "Zx1B..."
|
|
150
|
+
// }
|
|
151
|
+
//
|
|
152
|
+
// This sequence of `PartialResultSet`s encodes two rows, one
|
|
153
|
+
// containing the field value `"Hello"`, and a second containing the
|
|
154
|
+
// field value `"World" = "W" + "orl" + "d"`.
|
|
155
|
+
//
|
|
156
|
+
// Not all `PartialResultSet`s contain a `resume_token`. Execution can only be
|
|
157
|
+
// resumed from a previously yielded `resume_token`. For the above sequence of
|
|
158
|
+
// `PartialResultSet`s, resuming the query with `"resume_token": "Af65..."`
|
|
159
|
+
// yields results from the `PartialResultSet` with value "orl".
|
|
160
|
+
repeated google.protobuf.Value values = 2;
|
|
161
|
+
|
|
162
|
+
// If true, then the final value in
|
|
163
|
+
// [values][google.spanner.v1.PartialResultSet.values] is chunked, and must be
|
|
164
|
+
// combined with more values from subsequent `PartialResultSet`s to obtain a
|
|
165
|
+
// complete field value.
|
|
166
|
+
bool chunked_value = 3;
|
|
167
|
+
|
|
168
|
+
// Streaming calls might be interrupted for a variety of reasons, such
|
|
169
|
+
// as TCP connection loss. If this occurs, the stream of results can
|
|
170
|
+
// be resumed by re-sending the original request and including
|
|
171
|
+
// `resume_token`. Note that executing any other transaction in the
|
|
172
|
+
// same session invalidates the token.
|
|
173
|
+
bytes resume_token = 4;
|
|
174
|
+
|
|
175
|
+
// Query plan and execution statistics for the statement that produced this
|
|
176
|
+
// streaming result set. These can be requested by setting
|
|
177
|
+
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]
|
|
178
|
+
// and are sent only once with the last response in the stream. This field is
|
|
179
|
+
// also present in the last response for DML statements.
|
|
180
|
+
ResultSetStats stats = 5;
|
|
181
|
+
|
|
182
|
+
// Optional. A precommit token is included if the read-write transaction
|
|
183
|
+
// has multiplexed sessions enabled. Pass the precommit token with the highest
|
|
184
|
+
// sequence number from this transaction attempt to the
|
|
185
|
+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
|
|
186
|
+
MultiplexedSessionPrecommitToken precommit_token = 8
|
|
187
|
+
[(google.api.field_behavior) = OPTIONAL];
|
|
188
|
+
|
|
189
|
+
// Optional. Indicates whether this is the last `PartialResultSet` in the
|
|
190
|
+
// stream. The server might optionally set this field. Clients shouldn't rely
|
|
191
|
+
// on this field being set in all cases.
|
|
192
|
+
bool last = 9 [(google.api.field_behavior) = OPTIONAL];
|
|
193
|
+
|
|
194
|
+
// Optional. A cache update expresses a set of changes the client should
|
|
195
|
+
// incorporate into its location cache. The client should discard the changes
|
|
196
|
+
// if they are older than the data it already has. This data can be obtained
|
|
197
|
+
// in response to requests that included a `RoutingHint` field, but may also
|
|
198
|
+
// be obtained by explicit location-fetching RPCs which may be added in the
|
|
199
|
+
// future.
|
|
200
|
+
CacheUpdate cache_update = 10 [(google.api.field_behavior) = OPTIONAL];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Metadata about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
204
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet].
|
|
205
|
+
message ResultSetMetadata {
|
|
206
|
+
// Indicates the field names and types for the rows in the result
|
|
207
|
+
// set. For example, a SQL query like `"SELECT UserId, UserName FROM
|
|
208
|
+
// Users"` could return a `row_type` value like:
|
|
209
|
+
//
|
|
210
|
+
// "fields": [
|
|
211
|
+
// { "name": "UserId", "type": { "code": "INT64" } },
|
|
212
|
+
// { "name": "UserName", "type": { "code": "STRING" } },
|
|
213
|
+
// ]
|
|
214
|
+
StructType row_type = 1;
|
|
215
|
+
|
|
216
|
+
// If the read or SQL query began a transaction as a side-effect, the
|
|
217
|
+
// information about the new transaction is yielded here.
|
|
218
|
+
Transaction transaction = 2;
|
|
219
|
+
|
|
220
|
+
// A SQL query can be parameterized. In PLAN mode, these parameters can be
|
|
221
|
+
// undeclared. This indicates the field names and types for those undeclared
|
|
222
|
+
// parameters in the SQL query. For example, a SQL query like `"SELECT * FROM
|
|
223
|
+
// Users where UserId = @userId and UserName = @userName "` could return a
|
|
224
|
+
// `undeclared_parameters` value like:
|
|
225
|
+
//
|
|
226
|
+
// "fields": [
|
|
227
|
+
// { "name": "UserId", "type": { "code": "INT64" } },
|
|
228
|
+
// { "name": "UserName", "type": { "code": "STRING" } },
|
|
229
|
+
// ]
|
|
230
|
+
StructType undeclared_parameters = 3;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or
|
|
234
|
+
// [PartialResultSet][google.spanner.v1.PartialResultSet].
|
|
235
|
+
message ResultSetStats {
|
|
236
|
+
// [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this
|
|
237
|
+
// result.
|
|
238
|
+
QueryPlan query_plan = 1;
|
|
239
|
+
|
|
240
|
+
// Aggregated statistics from the execution of the query. Only present when
|
|
241
|
+
// the query is profiled. For example, a query could return the statistics as
|
|
242
|
+
// follows:
|
|
243
|
+
//
|
|
244
|
+
// {
|
|
245
|
+
// "rows_returned": "3",
|
|
246
|
+
// "elapsed_time": "1.22 secs",
|
|
247
|
+
// "cpu_time": "1.19 secs"
|
|
248
|
+
// }
|
|
249
|
+
google.protobuf.Struct query_stats = 2;
|
|
250
|
+
|
|
251
|
+
// The number of rows modified by the DML statement.
|
|
252
|
+
oneof row_count {
|
|
253
|
+
// Standard DML returns an exact count of rows that were modified.
|
|
254
|
+
int64 row_count_exact = 3;
|
|
255
|
+
|
|
256
|
+
// Partitioned DML doesn't offer exactly-once semantics, so it
|
|
257
|
+
// returns a lower bound of the rows modified.
|
|
258
|
+
int64 row_count_lower_bound = 4;
|
|
259
|
+
}
|
|
260
|
+
}
|