@google-cloud/spanner 8.2.0 → 8.2.2
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 +20 -1
- package/build/protos/google/spanner/v1/keys.proto +2 -2
- package/build/protos/google/spanner/v1/mutation.proto +31 -23
- package/build/protos/google/spanner/v1/query_plan.proto +21 -18
- package/build/protos/google/spanner/v1/spanner.proto +198 -204
- package/build/protos/google/spanner/v1/transaction.proto +3 -2
- package/build/protos/protos.json +3 -1
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +32 -12
- package/build/src/metrics/interceptor.js +10 -2
- package/build/src/metrics/metrics-tracer-factory.d.ts +2 -3
- package/build/src/metrics/metrics-tracer-factory.js +3 -5
- package/build/src/metrics/metrics-tracer.d.ts +2 -1
- package/build/src/metrics/metrics-tracer.js +4 -2
- package/build/src/metrics/spanner-metrics-exporter.d.ts +2 -1
- package/build/src/metrics/spanner-metrics-exporter.js +16 -23
- package/build/src/metrics/transform.d.ts +2 -2
- package/build/src/metrics/transform.js +7 -7
- package/build/src/v1/spanner_client.d.ts +155 -159
- package/build/src/v1/spanner_client.js +47 -52
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# [Cloud Spanner: Node.js Client](https://github.com/googleapis/nodejs-spanner)
|
|
6
6
|
|
|
7
7
|
[](https://cloud.google.com/terms/launch-stages)
|
|
8
|
-
[](https://www.npmjs.
|
|
8
|
+
[](https://www.npmjs.com/package/@google-cloud/spanner)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -80,7 +80,25 @@ console.log(`Query: ${rows.length} found.`);
|
|
|
80
80
|
rows.forEach(row => console.log(row));
|
|
81
81
|
|
|
82
82
|
```
|
|
83
|
+
## Multiplexed Sessions
|
|
83
84
|
|
|
85
|
+
Spanner's Multiplexed Sessions can now be used as an efficient alternative to the default session pool. This feature helps reduce
|
|
86
|
+
session management overhead and minimize session-related errors. Multiplexed sessions can be enabled for all transaction types via environment variables.
|
|
87
|
+
|
|
88
|
+
### Configuration
|
|
89
|
+
|
|
90
|
+
To enable this feature, set the following environment variables to `true`:
|
|
91
|
+
|
|
92
|
+
* **For Read-Only Transactions:**
|
|
93
|
+
- `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS`
|
|
94
|
+
* **For Partitioned Operations:**
|
|
95
|
+
- `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS`
|
|
96
|
+
- `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS`
|
|
97
|
+
* **For Read-Write Transactions:**
|
|
98
|
+
- `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS`
|
|
99
|
+
- `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW`
|
|
100
|
+
|
|
101
|
+
For a detailed explanation of this feature, please refer to the [official documentation](https://cloud.google.com/spanner/docs/sessions#multiplexed_sessions).
|
|
84
102
|
|
|
85
103
|
|
|
86
104
|
## Samples
|
|
@@ -191,6 +209,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-spanner/tre
|
|
|
191
209
|
| Queryoptions | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/queryoptions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/queryoptions.js,samples/README.md) |
|
|
192
210
|
| Quickstart | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
|
|
193
211
|
| Read data with database role | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/read-data-with-database-role.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/read-data-with-database-role.js,samples/README.md) |
|
|
212
|
+
| Performs a read-write transaction with isolation level option | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/repeatable-reads.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/repeatable-reads.js,samples/README.md) |
|
|
194
213
|
| Sets a request tag for a single query | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/request-tag.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/request-tag.js,samples/README.md) |
|
|
195
214
|
| Run Batch update with RPC priority | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/rpc-priority-batch-dml.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/rpc-priority-batch-dml.js,samples/README.md) |
|
|
196
215
|
| Run partitioned update with RPC priority | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/rpc-priority-partitioned-dml.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/rpc-priority-partitioned-dml.js,samples/README.md) |
|
|
@@ -152,8 +152,8 @@ message KeySet {
|
|
|
152
152
|
// encoded as described [here][google.spanner.v1.TypeCode].
|
|
153
153
|
repeated google.protobuf.ListValue keys = 1;
|
|
154
154
|
|
|
155
|
-
// A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more
|
|
156
|
-
// key range specifications.
|
|
155
|
+
// A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more
|
|
156
|
+
// information about key range specifications.
|
|
157
157
|
repeated KeyRange ranges = 2;
|
|
158
158
|
|
|
159
159
|
// For convenience `all` can be set to `true` to indicate that this
|
|
@@ -32,13 +32,16 @@ option ruby_package = "Google::Cloud::Spanner::V1";
|
|
|
32
32
|
// applied to a Cloud Spanner database by sending them in a
|
|
33
33
|
// [Commit][google.spanner.v1.Spanner.Commit] call.
|
|
34
34
|
message Mutation {
|
|
35
|
-
// Arguments to [insert][google.spanner.v1.Mutation.insert],
|
|
35
|
+
// Arguments to [insert][google.spanner.v1.Mutation.insert],
|
|
36
|
+
// [update][google.spanner.v1.Mutation.update],
|
|
37
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], and
|
|
36
38
|
// [replace][google.spanner.v1.Mutation.replace] operations.
|
|
37
39
|
message Write {
|
|
38
40
|
// Required. The table whose rows will be written.
|
|
39
41
|
string table = 1 [(google.api.field_behavior) = REQUIRED];
|
|
40
42
|
|
|
41
|
-
// The names of the columns in
|
|
43
|
+
// The names of the columns in
|
|
44
|
+
// [table][google.spanner.v1.Mutation.Write.table] to be written.
|
|
42
45
|
//
|
|
43
46
|
// The list of columns must contain enough columns to allow
|
|
44
47
|
// Cloud Spanner to derive values for all primary key columns in the
|
|
@@ -48,11 +51,13 @@ message Mutation {
|
|
|
48
51
|
// The values to be written. `values` can contain more than one
|
|
49
52
|
// list of values. If it does, then multiple rows are written, one
|
|
50
53
|
// for each entry in `values`. Each list in `values` must have
|
|
51
|
-
// exactly as many entries as there are entries in
|
|
52
|
-
// above. Sending
|
|
53
|
-
// `Mutation`s, each
|
|
54
|
-
//
|
|
55
|
-
//
|
|
54
|
+
// exactly as many entries as there are entries in
|
|
55
|
+
// [columns][google.spanner.v1.Mutation.Write.columns] above. Sending
|
|
56
|
+
// multiple lists is equivalent to sending multiple `Mutation`s, each
|
|
57
|
+
// containing one `values` entry and repeating
|
|
58
|
+
// [table][google.spanner.v1.Mutation.Write.table] and
|
|
59
|
+
// [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in
|
|
60
|
+
// each list are encoded as described [here][google.spanner.v1.TypeCode].
|
|
56
61
|
repeated google.protobuf.ListValue values = 3;
|
|
57
62
|
}
|
|
58
63
|
|
|
@@ -61,12 +66,12 @@ message Mutation {
|
|
|
61
66
|
// Required. The table whose rows will be deleted.
|
|
62
67
|
string table = 1 [(google.api.field_behavior) = REQUIRED];
|
|
63
68
|
|
|
64
|
-
// Required. The primary keys of the rows within
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
// Delete is idempotent. The transaction will
|
|
69
|
-
// rows do not exist.
|
|
69
|
+
// Required. The primary keys of the rows within
|
|
70
|
+
// [table][google.spanner.v1.Mutation.Delete.table] to delete. The primary
|
|
71
|
+
// keys must be specified in the order in which they appear in the `PRIMARY
|
|
72
|
+
// KEY()` clause of the table's equivalent DDL statement (the DDL statement
|
|
73
|
+
// used to create the table). Delete is idempotent. The transaction will
|
|
74
|
+
// succeed even if some or all rows do not exist.
|
|
70
75
|
KeySet key_set = 2 [(google.api.field_behavior) = REQUIRED];
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -80,19 +85,22 @@ message Mutation {
|
|
|
80
85
|
// already exist, the transaction fails with error `NOT_FOUND`.
|
|
81
86
|
Write update = 2;
|
|
82
87
|
|
|
83
|
-
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
84
|
-
// its column values are overwritten with the ones
|
|
85
|
-
// column values not explicitly written are preserved.
|
|
88
|
+
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
89
|
+
// already exists, then its column values are overwritten with the ones
|
|
90
|
+
// provided. Any column values not explicitly written are preserved.
|
|
86
91
|
//
|
|
87
|
-
// When using
|
|
88
|
-
//
|
|
89
|
-
//
|
|
92
|
+
// When using
|
|
93
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as
|
|
94
|
+
// when using [insert][google.spanner.v1.Mutation.insert], all `NOT NULL`
|
|
95
|
+
// columns in the table must be given a value. This holds true even when the
|
|
96
|
+
// row already exists and will therefore actually be updated.
|
|
90
97
|
Write insert_or_update = 3;
|
|
91
98
|
|
|
92
|
-
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
93
|
-
// deleted, and the column values provided are
|
|
94
|
-
// instead. Unlike
|
|
95
|
-
//
|
|
99
|
+
// Like [insert][google.spanner.v1.Mutation.insert], except that if the row
|
|
100
|
+
// already exists, it is deleted, and the column values provided are
|
|
101
|
+
// inserted instead. Unlike
|
|
102
|
+
// [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this
|
|
103
|
+
// means any values not explicitly written become `NULL`.
|
|
96
104
|
//
|
|
97
105
|
// In an interleaved table, if you create the child table with the
|
|
98
106
|
// `ON DELETE CASCADE` annotation, then replacing a parent row
|
|
@@ -26,10 +26,11 @@ option java_package = "com.google.spanner.v1";
|
|
|
26
26
|
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
27
27
|
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
28
28
|
|
|
29
|
-
// Node information for nodes appearing in a
|
|
29
|
+
// Node information for nodes appearing in a
|
|
30
|
+
// [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].
|
|
30
31
|
message PlanNode {
|
|
31
|
-
// The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between
|
|
32
|
-
// nodes that can appear in a query plan.
|
|
32
|
+
// The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between
|
|
33
|
+
// the two different kinds of nodes that can appear in a query plan.
|
|
33
34
|
enum Kind {
|
|
34
35
|
// Not specified.
|
|
35
36
|
KIND_UNSPECIFIED = 0;
|
|
@@ -58,14 +59,14 @@ message PlanNode {
|
|
|
58
59
|
// with the output variable.
|
|
59
60
|
string type = 2;
|
|
60
61
|
|
|
61
|
-
// Only present if the child node is
|
|
62
|
-
//
|
|
63
|
-
// the
|
|
64
|
-
// For example, a `TableScan` operator that reads rows from
|
|
65
|
-
// have child links to the `SCALAR` nodes representing the
|
|
66
|
-
// created for each column that is read by the operator.
|
|
67
|
-
// `variable` fields will be set to the variable names
|
|
68
|
-
// columns.
|
|
62
|
+
// Only present if the child node is
|
|
63
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds to an
|
|
64
|
+
// output variable of the parent node. The field carries the name of the
|
|
65
|
+
// output variable. For example, a `TableScan` operator that reads rows from
|
|
66
|
+
// a table will have child links to the `SCALAR` nodes representing the
|
|
67
|
+
// output variables created for each column that is read by the operator.
|
|
68
|
+
// The corresponding `variable` fields will be set to the variable names
|
|
69
|
+
// assigned to the columns.
|
|
69
70
|
string variable = 3;
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -83,14 +84,15 @@ message PlanNode {
|
|
|
83
84
|
map<string, int32> subqueries = 2;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
// The `PlanNode`'s index in [node
|
|
87
|
+
// The `PlanNode`'s index in [node
|
|
88
|
+
// list][google.spanner.v1.QueryPlan.plan_nodes].
|
|
87
89
|
int32 index = 1;
|
|
88
90
|
|
|
89
91
|
// Used to determine the type of node. May be needed for visualizing
|
|
90
92
|
// different kinds of nodes differently. For example, If the node is a
|
|
91
|
-
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a
|
|
92
|
-
// which can be used to directly embed a description
|
|
93
|
-
// parent.
|
|
93
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a
|
|
94
|
+
// condensed representation which can be used to directly embed a description
|
|
95
|
+
// of the node in its parent.
|
|
94
96
|
Kind kind = 2;
|
|
95
97
|
|
|
96
98
|
// The display name for the node.
|
|
@@ -99,7 +101,8 @@ message PlanNode {
|
|
|
99
101
|
// List of child node `index`es and their relationship to this parent.
|
|
100
102
|
repeated ChildLink child_links = 4;
|
|
101
103
|
|
|
102
|
-
// Condensed representation for
|
|
104
|
+
// Condensed representation for
|
|
105
|
+
// [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes.
|
|
103
106
|
ShortRepresentation short_representation = 5;
|
|
104
107
|
|
|
105
108
|
// Attributes relevant to the node contained in a group of key-value pairs.
|
|
@@ -122,7 +125,7 @@ message PlanNode {
|
|
|
122
125
|
// Contains an ordered list of nodes appearing in the query plan.
|
|
123
126
|
message QueryPlan {
|
|
124
127
|
// The nodes in the query plan. Plan nodes are returned in pre-order starting
|
|
125
|
-
// with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id`
|
|
126
|
-
// `plan_nodes`.
|
|
128
|
+
// with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id`
|
|
129
|
+
// corresponds to its index in `plan_nodes`.
|
|
127
130
|
repeated PlanNode plan_nodes = 1;
|
|
128
131
|
}
|