@google-cloud/spanner 5.16.2 → 5.18.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +25 -12
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +177 -9
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +14 -2
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -5
  6. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
  7. package/build/protos/google/spanner/v1/commit_response.proto +2 -4
  8. package/build/protos/google/spanner/v1/keys.proto +0 -1
  9. package/build/protos/google/spanner/v1/mutation.proto +5 -5
  10. package/build/protos/google/spanner/v1/query_plan.proto +18 -19
  11. package/build/protos/google/spanner/v1/result_set.proto +1 -1
  12. package/build/protos/google/spanner/v1/spanner.proto +21 -19
  13. package/build/protos/google/spanner/v1/transaction.proto +19 -32
  14. package/build/protos/google/spanner/v1/type.proto +33 -7
  15. package/build/protos/protos.d.ts +463 -64
  16. package/build/protos/protos.js +1267 -182
  17. package/build/protos/protos.json +221 -21
  18. package/build/src/backup.d.ts +22 -4
  19. package/build/src/backup.js +60 -29
  20. package/build/src/codec.d.ts +11 -0
  21. package/build/src/codec.js +41 -3
  22. package/build/src/database.d.ts +1 -1
  23. package/build/src/database.js +2 -2
  24. package/build/src/index.d.ts +20 -5
  25. package/build/src/index.js +26 -7
  26. package/build/src/instance.d.ts +44 -5
  27. package/build/src/instance.js +61 -6
  28. package/build/src/partial-result-stream.js +3 -0
  29. package/build/src/session-pool.d.ts +4 -4
  30. package/build/src/session-pool.js +6 -6
  31. package/build/src/transaction.js +1 -1
  32. package/build/src/v1/database_admin_client.d.ts +175 -10
  33. package/build/src/v1/database_admin_client.js +113 -11
  34. package/build/src/v1/database_admin_client_config.json +5 -0
  35. package/build/src/v1/instance_admin_client.js +2 -3
  36. package/build/src/v1/spanner_client.d.ts +1 -31
  37. package/build/src/v1/spanner_client.js +11 -9
  38. package/package.json +4 -4
@@ -17,7 +17,6 @@ syntax = "proto3";
17
17
  package google.spanner.v1;
18
18
 
19
19
  import "google/protobuf/struct.proto";
20
- import "google/api/annotations.proto";
21
20
 
22
21
  option csharp_namespace = "Google.Cloud.Spanner.V1";
23
22
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -29,6 +28,24 @@ option ruby_package = "Google::Cloud::Spanner::V1";
29
28
 
30
29
  // Node information for nodes appearing in a [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].
31
30
  message PlanNode {
31
+ // The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of
32
+ // nodes that can appear in a query plan.
33
+ enum Kind {
34
+ // Not specified.
35
+ KIND_UNSPECIFIED = 0;
36
+
37
+ // Denotes a Relational operator node in the expression tree. Relational
38
+ // operators represent iterative processing of rows during query execution.
39
+ // For example, a `TableScan` operation that reads rows from a table.
40
+ RELATIONAL = 1;
41
+
42
+ // Denotes a Scalar node in the expression tree. Scalar nodes represent
43
+ // non-iterable entities in the query plan. For example, constants or
44
+ // arithmetic operators appearing inside predicate expressions or references
45
+ // to column names.
46
+ SCALAR = 2;
47
+ }
48
+
32
49
  // Metadata associated with a parent-child relationship appearing in a
33
50
  // [PlanNode][google.spanner.v1.PlanNode].
34
51
  message ChildLink {
@@ -66,24 +83,6 @@ message PlanNode {
66
83
  map<string, int32> subqueries = 2;
67
84
  }
68
85
 
69
- // The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of
70
- // nodes that can appear in a query plan.
71
- enum Kind {
72
- // Not specified.
73
- KIND_UNSPECIFIED = 0;
74
-
75
- // Denotes a Relational operator node in the expression tree. Relational
76
- // operators represent iterative processing of rows during query execution.
77
- // For example, a `TableScan` operation that reads rows from a table.
78
- RELATIONAL = 1;
79
-
80
- // Denotes a Scalar node in the expression tree. Scalar nodes represent
81
- // non-iterable entities in the query plan. For example, constants or
82
- // arithmetic operators appearing inside predicate expressions or references
83
- // to column names.
84
- SCALAR = 2;
85
- }
86
-
87
86
  // The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes].
88
87
  int32 index = 1;
89
88
 
@@ -17,10 +17,10 @@ syntax = "proto3";
17
17
  package google.spanner.v1;
18
18
 
19
19
  import "google/protobuf/struct.proto";
20
+ import "google/spanner/v1/commit_response.proto";
20
21
  import "google/spanner/v1/query_plan.proto";
21
22
  import "google/spanner/v1/transaction.proto";
22
23
  import "google/spanner/v1/type.proto";
23
- import "google/api/annotations.proto";
24
24
 
25
25
  option cc_enable_arenas = true;
26
26
  option csharp_namespace = "Google.Cloud.Spanner.V1";
@@ -16,7 +16,6 @@ syntax = "proto3";
16
16
 
17
17
  package google.spanner.v1;
18
18
 
19
- import public "google/spanner/v1/commit_response.proto";
20
19
  import "google/api/annotations.proto";
21
20
  import "google/api/client.proto";
22
21
  import "google/api/field_behavior.proto";
@@ -25,6 +24,7 @@ import "google/protobuf/empty.proto";
25
24
  import "google/protobuf/struct.proto";
26
25
  import "google/protobuf/timestamp.proto";
27
26
  import "google/rpc/status.proto";
27
+ import public "google/spanner/v1/commit_response.proto";
28
28
  import "google/spanner/v1/keys.proto";
29
29
  import "google/spanner/v1/mutation.proto";
30
30
  import "google/spanner/v1/result_set.proto";
@@ -300,8 +300,8 @@ message CreateSessionRequest {
300
300
  }
301
301
  ];
302
302
 
303
- // The session to create.
304
- Session session = 2;
303
+ // Required. The session to create.
304
+ Session session = 2 [(google.api.field_behavior) = REQUIRED];
305
305
  }
306
306
 
307
307
  // The request for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
@@ -469,6 +469,7 @@ message RequestOptions {
469
469
  // Legal characters for `request_tag` values are all printable characters
470
470
  // (ASCII 32 - 126) and the length of a request_tag is limited to 50
471
471
  // characters. Values that exceed this limit are truncated.
472
+ // Any leading underscore (_) characters will be removed from the string.
472
473
  string request_tag = 2;
473
474
 
474
475
  // A tag used for statistics collection about this transaction.
@@ -476,17 +477,32 @@ message RequestOptions {
476
477
  // that belongs to a transaction.
477
478
  // The value of transaction_tag should be the same for all requests belonging
478
479
  // to the same transaction.
479
- // If this request doesn’t belong to any transaction, transaction_tag will be
480
+ // If this request doesn't belong to any transaction, transaction_tag will be
480
481
  // ignored.
481
482
  // Legal characters for `transaction_tag` values are all printable characters
482
483
  // (ASCII 32 - 126) and the length of a transaction_tag is limited to 50
483
484
  // characters. Values that exceed this limit are truncated.
485
+ // Any leading underscore (_) characters will be removed from the string.
484
486
  string transaction_tag = 3;
485
487
  }
486
488
 
487
489
  // The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
488
490
  // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
489
491
  message ExecuteSqlRequest {
492
+ // Mode in which the statement must be processed.
493
+ enum QueryMode {
494
+ // The default mode. Only the statement results are returned.
495
+ NORMAL = 0;
496
+
497
+ // This mode returns only the query plan, without any results or
498
+ // execution statistics information.
499
+ PLAN = 1;
500
+
501
+ // This mode returns both the query plan and the execution statistics along
502
+ // with the results.
503
+ PROFILE = 2;
504
+ }
505
+
490
506
  // Query optimizer configuration.
491
507
  message QueryOptions {
492
508
  // An option to control the selection of optimizer version.
@@ -540,20 +556,6 @@ message ExecuteSqlRequest {
540
556
  string optimizer_statistics_package = 2;
541
557
  }
542
558
 
543
- // Mode in which the statement must be processed.
544
- enum QueryMode {
545
- // The default mode. Only the statement results are returned.
546
- NORMAL = 0;
547
-
548
- // This mode returns only the query plan, without any results or
549
- // execution statistics information.
550
- PLAN = 1;
551
-
552
- // This mode returns both the query plan and the execution statistics along
553
- // with the results.
554
- PROFILE = 2;
555
- }
556
-
557
559
  // Required. The session in which the SQL query should be performed.
558
560
  string session = 1 [
559
561
  (google.api.field_behavior) = REQUIRED,
@@ -645,7 +647,7 @@ message ExecuteBatchDmlRequest {
645
647
  // A single DML statement.
646
648
  message Statement {
647
649
  // Required. The DML string.
648
- string sql = 1;
650
+ string sql = 1 [(google.api.field_behavior) = REQUIRED];
649
651
 
650
652
  // Parameter names and values that bind to placeholders in the DML string.
651
653
  //
@@ -18,7 +18,6 @@ package google.spanner.v1;
18
18
 
19
19
  import "google/protobuf/duration.proto";
20
20
  import "google/protobuf/timestamp.proto";
21
- import "google/api/annotations.proto";
22
21
 
23
22
  option csharp_namespace = "Google.Cloud.Spanner.V1";
24
23
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -28,8 +27,7 @@ option java_package = "com.google.spanner.v1";
28
27
  option php_namespace = "Google\\Cloud\\Spanner\\V1";
29
28
  option ruby_package = "Google::Cloud::Spanner::V1";
30
29
 
31
- // # Transactions
32
- //
30
+ // Transactions:
33
31
  //
34
32
  // Each session can have at most one active transaction at a time (note that
35
33
  // standalone reads and queries use a transaction internally and do count
@@ -37,8 +35,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
37
35
  // completed, the session can immediately be re-used for the next transaction.
38
36
  // It is not necessary to create a new session for each transaction.
39
37
  //
40
- // # Transaction Modes
41
- //
38
+ // Transaction Modes:
42
39
  // Cloud Spanner supports three transaction modes:
43
40
  //
44
41
  // 1. Locking read-write. This type of transaction is the only way
@@ -70,8 +67,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
70
67
  // may, however, read/write data in different tables within that
71
68
  // database.
72
69
  //
73
- // ## Locking Read-Write Transactions
74
- //
70
+ // Locking Read-Write Transactions:
75
71
  // Locking transactions may be used to atomically read-modify-write
76
72
  // data anywhere in a database. This type of transaction is externally
77
73
  // consistent.
@@ -93,8 +89,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
93
89
  // [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the
94
90
  // transaction.
95
91
  //
96
- // ## Semantics
97
- //
92
+ // Semantics:
98
93
  // Cloud Spanner can commit the transaction if all read locks it acquired
99
94
  // are still valid at commit time, and it is able to acquire write
100
95
  // locks for all writes. Cloud Spanner can abort the transaction for any
@@ -106,8 +101,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
106
101
  // use Cloud Spanner locks for any sort of mutual exclusion other than
107
102
  // between Cloud Spanner transactions themselves.
108
103
  //
109
- // ## Retrying Aborted Transactions
110
- //
104
+ // Retrying Aborted Transactions:
111
105
  // When a transaction aborts, the application can choose to retry the
112
106
  // whole transaction again. To maximize the chances of successfully
113
107
  // committing the retry, the client should execute the retry in the
@@ -115,27 +109,25 @@ option ruby_package = "Google::Cloud::Spanner::V1";
115
109
  // priority increases with each consecutive abort, meaning that each
116
110
  // attempt has a slightly better chance of success than the previous.
117
111
  //
118
- // Under some circumstances (e.g., many transactions attempting to
112
+ // Under some circumstances (for example, many transactions attempting to
119
113
  // modify the same row(s)), a transaction can abort many times in a
120
114
  // short period before successfully committing. Thus, it is not a good
121
115
  // idea to cap the number of retries a transaction can attempt;
122
- // instead, it is better to limit the total amount of wall time spent
116
+ // instead, it is better to limit the total amount of time spent
123
117
  // retrying.
124
118
  //
125
- // ## Idle Transactions
126
- //
119
+ // Idle Transactions:
127
120
  // A transaction is considered idle if it has no outstanding reads or
128
121
  // SQL queries and has not started a read or SQL query within the last 10
129
122
  // seconds. Idle transactions can be aborted by Cloud Spanner so that they
130
- // don't hold on to locks indefinitely. In that case, the commit will
131
- // fail with error `ABORTED`.
123
+ // don't hold on to locks indefinitely. If an idle transaction is aborted, the
124
+ // commit will fail with error `ABORTED`.
132
125
  //
133
126
  // If this behavior is undesirable, periodically executing a simple
134
- // SQL query in the transaction (e.g., `SELECT 1`) prevents the
127
+ // SQL query in the transaction (for example, `SELECT 1`) prevents the
135
128
  // transaction from becoming idle.
136
129
  //
137
- // ## Snapshot Read-Only Transactions
138
- //
130
+ // Snapshot Read-Only Transactions:
139
131
  // Snapshot read-only transactions provides a simpler method than
140
132
  // locking read-write transactions for doing several consistent
141
133
  // reads. However, this type of transaction does not support writes.
@@ -172,8 +164,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
172
164
  //
173
165
  // Each type of timestamp bound is discussed in detail below.
174
166
  //
175
- // ## Strong
176
- //
167
+ // Strong:
177
168
  // Strong reads are guaranteed to see the effects of all transactions
178
169
  // that have committed before the start of the read. Furthermore, all
179
170
  // rows yielded by a single read are consistent with each other -- if
@@ -188,13 +179,12 @@ option ruby_package = "Google::Cloud::Spanner::V1";
188
179
  //
189
180
  // See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
190
181
  //
191
- // ## Exact Staleness
192
- //
182
+ // Exact Staleness:
193
183
  // These timestamp bounds execute reads at a user-specified
194
184
  // timestamp. Reads at a timestamp are guaranteed to see a consistent
195
185
  // prefix of the global transaction history: they observe
196
- // modifications done by all transactions with a commit timestamp <=
197
- // the read timestamp, and observe none of the modifications done by
186
+ // modifications done by all transactions with a commit timestamp less than or
187
+ // equal to the read timestamp, and observe none of the modifications done by
198
188
  // transactions with a larger commit timestamp. They will block until
199
189
  // all conflicting transactions that may be assigned commit timestamps
200
190
  // <= the read timestamp have finished.
@@ -210,8 +200,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
210
200
  // See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and
211
201
  // [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness].
212
202
  //
213
- // ## Bounded Staleness
214
- //
203
+ // Bounded Staleness:
215
204
  // Bounded staleness modes allow Cloud Spanner to pick the read timestamp,
216
205
  // subject to a user-provided staleness bound. Cloud Spanner chooses the
217
206
  // newest timestamp within the staleness bound that allows execution
@@ -240,8 +229,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
240
229
  // See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and
241
230
  // [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp].
242
231
  //
243
- // ## Old Read Timestamps and Garbage Collection
244
- //
232
+ // Old Read Timestamps and Garbage Collection:
245
233
  // Cloud Spanner continuously garbage collects deleted and overwritten data
246
234
  // in the background to reclaim storage space. This process is known
247
235
  // as "version GC". By default, version GC reclaims versions after they
@@ -251,8 +239,7 @@ option ruby_package = "Google::Cloud::Spanner::V1";
251
239
  // timestamp become too old while executing. Reads and SQL queries with
252
240
  // too-old read timestamps fail with the error `FAILED_PRECONDITION`.
253
241
  //
254
- // ## Partitioned DML Transactions
255
- //
242
+ // Partitioned DML Transactions:
256
243
  // Partitioned DML transactions are used to execute DML statements with a
257
244
  // different execution strategy that provides different, and often better,
258
245
  // scalability properties for large, table-wide operations than DML in a
@@ -17,7 +17,6 @@ syntax = "proto3";
17
17
  package google.spanner.v1;
18
18
 
19
19
  import "google/api/field_behavior.proto";
20
- import "google/api/annotations.proto";
21
20
 
22
21
  option csharp_namespace = "Google.Cloud.Spanner.V1";
23
22
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -40,6 +39,14 @@ message Type {
40
39
  // If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type`
41
40
  // provides type information for the struct's fields.
42
41
  StructType struct_type = 3;
42
+
43
+ // The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
44
+ // use to represent values of this type during query processing. This is
45
+ // necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
46
+ // to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
47
+ // typically is not needed to process the content of a value (it doesn't
48
+ // affect serialization) and clients can ignore it on the read path.
49
+ TypeAnnotationCode type_annotation = 4;
43
50
  }
44
51
 
45
52
  // `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
@@ -129,12 +136,31 @@ enum TypeCode {
129
136
  // <br>(ExponentIndicator is `"e"` or `"E"`)
130
137
  NUMERIC = 10;
131
138
 
132
- // Encoded as a JSON-formatted 'string' as described in RFC 7159. The
133
- // following rules will be applied when parsing JSON input:
134
- // - Whitespace will be stripped from the document.
135
- // - If a JSON object has duplicate keys, only the first key will be
136
- // preserved.
139
+ // Encoded as a JSON-formatted `string` as described in RFC 7159. The
140
+ // following rules are applied when parsing JSON input:
141
+ //
142
+ // - Whitespace characters are not preserved.
143
+ // - If a JSON object has duplicate keys, only the first key is preserved.
137
144
  // - Members of a JSON object are not guaranteed to have their order
138
- // preserved. JSON array elements will have their order preserved.
145
+ // preserved.
146
+ // - JSON array elements will have their order preserved.
139
147
  JSON = 11;
140
148
  }
149
+
150
+ // `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to
151
+ // disambiguate SQL types that should be used for a given Cloud Spanner value.
152
+ // Disambiguation is needed because the same Cloud Spanner type can be mapped to
153
+ // different SQL types depending on SQL dialect. TypeAnnotationCode doesn't
154
+ // affect the way value is serialized.
155
+ enum TypeAnnotationCode {
156
+ // Not specified.
157
+ TYPE_ANNOTATION_CODE_UNSPECIFIED = 0;
158
+
159
+ // PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
160
+ // [Type][google.spanner.v1.Type] instances having [NUMERIC][google.spanner.v1.TypeCode.NUMERIC]
161
+ // type code to specify that values of this type should be treated as
162
+ // PostgreSQL NUMERIC values. Currently this annotation is always needed for
163
+ // [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with PostgreSQL-enabled
164
+ // Spanner databases.
165
+ PG_NUMERIC = 2;
166
+ }