google-cloud-spanner 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LOGGING.md +1 -1
- data/OVERVIEW.md +1 -1
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +29 -29
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +13 -13
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +28 -28
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +9 -9
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +8 -8
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +11 -11
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +21 -21
- data/lib/google/cloud/spanner/admin/database/v1.rb +4 -4
- data/lib/google/cloud/spanner/admin/database.rb +4 -4
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +13 -13
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +28 -28
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +9 -9
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +8 -8
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +7 -7
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +11 -11
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +30 -30
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +44 -44
- data/lib/google/cloud/spanner/admin/instance/v1.rb +4 -4
- data/lib/google/cloud/spanner/admin/instance.rb +4 -4
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +3 -3
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +11 -11
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +7 -7
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +19 -19
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +6 -6
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +11 -11
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +33 -19
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +65 -39
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +91 -21
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +25 -25
- data/lib/google/cloud/spanner/v1/spanner_client.rb +139 -79
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +1 -1
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +1 -1
- data/lib/google/spanner/v1/result_set_pb.rb +4 -0
- data/lib/google/spanner/v1/spanner_pb.rb +1 -0
- data/lib/google/spanner/v1/spanner_services_pb.rb +14 -6
- data/lib/google/spanner/v1/transaction_pb.rb +4 -0
- data/lib/google-cloud-spanner.rb +1 -1
- metadata +3 -3
@@ -29,13 +29,13 @@ module Google
|
|
29
29
|
#
|
30
30
|
# = Examples
|
31
31
|
#
|
32
|
-
# Example 1: Compute Timestamp from POSIX
|
32
|
+
# Example 1: Compute Timestamp from POSIX `time()`.
|
33
33
|
#
|
34
34
|
# Timestamp timestamp;
|
35
35
|
# timestamp.set_seconds(time(NULL));
|
36
36
|
# timestamp.set_nanos(0);
|
37
37
|
#
|
38
|
-
# Example 2: Compute Timestamp from POSIX
|
38
|
+
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
39
39
|
#
|
40
40
|
# struct timeval tv;
|
41
41
|
# gettimeofday(&tv, NULL);
|
@@ -44,7 +44,7 @@ module Google
|
|
44
44
|
# timestamp.set_seconds(tv.tv_sec);
|
45
45
|
# timestamp.set_nanos(tv.tv_usec * 1000);
|
46
46
|
#
|
47
|
-
# Example 3: Compute Timestamp from Win32
|
47
|
+
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
48
48
|
#
|
49
49
|
# FILETIME ft;
|
50
50
|
# GetSystemTimeAsFileTime(&ft);
|
@@ -56,7 +56,7 @@ module Google
|
|
56
56
|
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
57
57
|
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
58
58
|
#
|
59
|
-
# Example 4: Compute Timestamp from Java
|
59
|
+
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
60
60
|
#
|
61
61
|
# long millis = System.currentTimeMillis();
|
62
62
|
#
|
@@ -87,10 +87,10 @@ module Google
|
|
87
87
|
#
|
88
88
|
# In JavaScript, one can convert a Date object to this format using the
|
89
89
|
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
90
|
-
# method. In Python, a standard
|
91
|
-
# to this format using [
|
90
|
+
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
|
+
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
92
|
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
|
-
# can use the Joda Time's [
|
93
|
+
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
94
|
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
|
95
95
|
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
96
|
# @!attribute [rw] seconds
|
@@ -37,14 +37,14 @@ module Google
|
|
37
37
|
# ["Bob", "2014-09-23"]
|
38
38
|
# ["Alfred", "2015-06-12"]
|
39
39
|
#
|
40
|
-
# Since the
|
41
|
-
# columns, each
|
42
|
-
#
|
40
|
+
# Since the `UserEvents` table's `PRIMARY KEY` clause names two
|
41
|
+
# columns, each `UserEvents` key has two elements; the first is the
|
42
|
+
# `UserName`, and the second is the `EventDate`.
|
43
43
|
#
|
44
44
|
# Key ranges with multiple components are interpreted
|
45
45
|
# lexicographically by component using the table or index key's declared
|
46
46
|
# sort order. For example, the following range returns all events for
|
47
|
-
# user
|
47
|
+
# user `"Bob"` that occurred in the year 2015:
|
48
48
|
#
|
49
49
|
# "start_closed": ["Bob", "2015-01-01"]
|
50
50
|
# "end_closed": ["Bob", "2015-12-31"]
|
@@ -55,13 +55,13 @@ module Google
|
|
55
55
|
# provided components are included; if the key is open, then rows
|
56
56
|
# that exactly match are not included.
|
57
57
|
#
|
58
|
-
# For example, the following range includes all events for
|
58
|
+
# For example, the following range includes all events for `"Bob"` that
|
59
59
|
# occurred during and after the year 2000:
|
60
60
|
#
|
61
61
|
# "start_closed": ["Bob", "2000-01-01"]
|
62
62
|
# "end_closed": ["Bob"]
|
63
63
|
#
|
64
|
-
# The next example retrieves all events for
|
64
|
+
# The next example retrieves all events for `"Bob"`:
|
65
65
|
#
|
66
66
|
# "start_closed": ["Bob"]
|
67
67
|
# "end_closed": ["Bob"]
|
@@ -76,13 +76,13 @@ module Google
|
|
76
76
|
# "start_closed": []
|
77
77
|
# "end_closed": []
|
78
78
|
#
|
79
|
-
# This range returns all users whose
|
79
|
+
# This range returns all users whose `UserName` begins with any
|
80
80
|
# character from A to C:
|
81
81
|
#
|
82
82
|
# "start_closed": ["A"]
|
83
83
|
# "end_open": ["D"]
|
84
84
|
#
|
85
|
-
# This range returns all users whose
|
85
|
+
# This range returns all users whose `UserName` begins with B:
|
86
86
|
#
|
87
87
|
# "start_closed": ["B"]
|
88
88
|
# "end_open": ["C"]
|
@@ -102,26 +102,26 @@ module Google
|
|
102
102
|
# "end_closed": ["1"]
|
103
103
|
#
|
104
104
|
# Note that 100 is passed as the start, and 1 is passed as the end,
|
105
|
-
# because
|
105
|
+
# because `Key` is a descending column in the schema.
|
106
106
|
# @!attribute [rw] start_closed
|
107
107
|
# @return [Google::Protobuf::ListValue]
|
108
108
|
# If the start is closed, then the range includes all rows whose
|
109
|
-
# first
|
109
|
+
# first `len(start_closed)` key columns exactly match `start_closed`.
|
110
110
|
# @!attribute [rw] start_open
|
111
111
|
# @return [Google::Protobuf::ListValue]
|
112
112
|
# If the start is open, then the range excludes rows whose first
|
113
|
-
#
|
113
|
+
# `len(start_open)` key columns exactly match `start_open`.
|
114
114
|
# @!attribute [rw] end_closed
|
115
115
|
# @return [Google::Protobuf::ListValue]
|
116
116
|
# If the end is closed, then the range includes all rows whose
|
117
|
-
# first
|
117
|
+
# first `len(end_closed)` key columns exactly match `end_closed`.
|
118
118
|
# @!attribute [rw] end_open
|
119
119
|
# @return [Google::Protobuf::ListValue]
|
120
120
|
# If the end is open, then the range excludes rows whose first
|
121
|
-
#
|
121
|
+
# `len(end_open)` key columns exactly match `end_open`.
|
122
122
|
class KeyRange; end
|
123
123
|
|
124
|
-
#
|
124
|
+
# `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All
|
125
125
|
# the keys are expected to be in the same table or index. The keys need
|
126
126
|
# not be sorted in any particular way.
|
127
127
|
#
|
@@ -130,9 +130,9 @@ module Google
|
|
130
130
|
# behaves as if the key were only specified once.
|
131
131
|
# @!attribute [rw] keys
|
132
132
|
# @return [Array<Google::Protobuf::ListValue>]
|
133
|
-
# A list of specific keys. Entries in
|
133
|
+
# A list of specific keys. Entries in `keys` should have exactly as
|
134
134
|
# many elements as there are columns in the primary or index key
|
135
|
-
# with which this
|
135
|
+
# with which this `KeySet` is used. Individual key values are
|
136
136
|
# encoded as described {Google::Spanner::V1::TypeCode here}.
|
137
137
|
# @!attribute [rw] ranges
|
138
138
|
# @return [Array<Google::Spanner::V1::KeyRange>]
|
@@ -140,9 +140,9 @@ module Google
|
|
140
140
|
# key range specifications.
|
141
141
|
# @!attribute [rw] all
|
142
142
|
# @return [true, false]
|
143
|
-
# For convenience
|
144
|
-
#
|
145
|
-
# specified in
|
143
|
+
# For convenience `all` can be set to `true` to indicate that this
|
144
|
+
# `KeySet` matches all keys in the table or index. Note that any keys
|
145
|
+
# specified in `keys` or `ranges` are only yielded once.
|
146
146
|
class KeySet; end
|
147
147
|
end
|
148
148
|
end
|
@@ -22,11 +22,11 @@ module Google
|
|
22
22
|
# @!attribute [rw] insert
|
23
23
|
# @return [Google::Spanner::V1::Mutation::Write]
|
24
24
|
# Insert new rows in a table. If any of the rows already exist,
|
25
|
-
# the write or transaction fails with error
|
25
|
+
# the write or transaction fails with error `ALREADY_EXISTS`.
|
26
26
|
# @!attribute [rw] update
|
27
27
|
# @return [Google::Spanner::V1::Mutation::Write]
|
28
28
|
# Update existing rows in a table. If any of the rows does not
|
29
|
-
# already exist, the transaction fails with error
|
29
|
+
# already exist, the transaction fails with error `NOT_FOUND`.
|
30
30
|
# @!attribute [rw] insert_or_update
|
31
31
|
# @return [Google::Spanner::V1::Mutation::Write]
|
32
32
|
# Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, then
|
@@ -37,7 +37,7 @@ module Google
|
|
37
37
|
# Like {Google::Spanner::V1::Mutation#insert insert}, except that if the row already exists, it is
|
38
38
|
# deleted, and the column values provided are inserted
|
39
39
|
# instead. Unlike {Google::Spanner::V1::Mutation#insert_or_update insert_or_update}, this means any values not
|
40
|
-
# explicitly written become
|
40
|
+
# explicitly written become `NULL`.
|
41
41
|
# @!attribute [rw] delete
|
42
42
|
# @return [Google::Spanner::V1::Mutation::Delete]
|
43
43
|
# Delete rows from a table. Succeeds whether or not the named
|
@@ -57,12 +57,12 @@ module Google
|
|
57
57
|
# row(s) to be modified.
|
58
58
|
# @!attribute [rw] values
|
59
59
|
# @return [Array<Google::Protobuf::ListValue>]
|
60
|
-
# The values to be written.
|
60
|
+
# The values to be written. `values` can contain more than one
|
61
61
|
# list of values. If it does, then multiple rows are written, one
|
62
|
-
# for each entry in
|
62
|
+
# for each entry in `values`. Each list in `values` must have
|
63
63
|
# exactly as many entries as there are entries in {Google::Spanner::V1::Mutation::Write#columns columns}
|
64
64
|
# above. Sending multiple lists is equivalent to sending multiple
|
65
|
-
#
|
65
|
+
# `Mutation`s, each containing one `values` entry and repeating
|
66
66
|
# {Google::Spanner::V1::Mutation::Write#table table} and {Google::Spanner::V1::Mutation::Write#columns columns}. Individual values in each list are
|
67
67
|
# encoded as described {Google::Spanner::V1::TypeCode here}.
|
68
68
|
class Write; end
|
@@ -19,7 +19,7 @@ module Google
|
|
19
19
|
# Node information for nodes appearing in a {Google::Spanner::V1::QueryPlan#plan_nodes QueryPlan#plan_nodes}.
|
20
20
|
# @!attribute [rw] index
|
21
21
|
# @return [Integer]
|
22
|
-
# The
|
22
|
+
# The `PlanNode`'s index in {Google::Spanner::V1::QueryPlan#plan_nodes node list}.
|
23
23
|
# @!attribute [rw] kind
|
24
24
|
# @return [Google::Spanner::V1::PlanNode::Kind]
|
25
25
|
# Used to determine the type of node. May be needed for visualizing
|
@@ -32,7 +32,7 @@ module Google
|
|
32
32
|
# The display name for the node.
|
33
33
|
# @!attribute [rw] child_links
|
34
34
|
# @return [Array<Google::Spanner::V1::PlanNode::ChildLink>]
|
35
|
-
# List of child node
|
35
|
+
# List of child node `index`es and their relationship to this parent.
|
36
36
|
# @!attribute [rw] short_representation
|
37
37
|
# @return [Google::Spanner::V1::PlanNode::ShortRepresentation]
|
38
38
|
# Condensed representation for {Google::Spanner::V1::PlanNode::Kind::SCALAR SCALAR} nodes.
|
@@ -69,24 +69,24 @@ module Google
|
|
69
69
|
# Only present if the child node is {Google::Spanner::V1::PlanNode::Kind::SCALAR SCALAR} and corresponds
|
70
70
|
# to an output variable of the parent node. The field carries the name of
|
71
71
|
# the output variable.
|
72
|
-
# For example, a
|
73
|
-
# have child links to the
|
72
|
+
# For example, a `TableScan` operator that reads rows from a table will
|
73
|
+
# have child links to the `SCALAR` nodes representing the output variables
|
74
74
|
# created for each column that is read by the operator. The corresponding
|
75
|
-
#
|
75
|
+
# `variable` fields will be set to the variable names assigned to the
|
76
76
|
# columns.
|
77
77
|
class ChildLink; end
|
78
78
|
|
79
79
|
# Condensed representation of a node and its subtree. Only present for
|
80
|
-
#
|
80
|
+
# `SCALAR` {Google::Spanner::V1::PlanNode PlanNode(s)}.
|
81
81
|
# @!attribute [rw] description
|
82
82
|
# @return [String]
|
83
83
|
# A string representation of the expression subtree rooted at this node.
|
84
84
|
# @!attribute [rw] subqueries
|
85
85
|
# @return [Hash{String => Integer}]
|
86
86
|
# A mapping of (subquery variable name) -> (subquery node id) for cases
|
87
|
-
# where the
|
87
|
+
# where the `description` string of this node references a `SCALAR`
|
88
88
|
# subquery contained in the expression subtree rooted at this node. The
|
89
|
-
# referenced
|
89
|
+
# referenced `SCALAR` subquery may not necessarily be a direct child of
|
90
90
|
# this node.
|
91
91
|
class ShortRepresentation; end
|
92
92
|
|
@@ -98,7 +98,7 @@ module Google
|
|
98
98
|
|
99
99
|
# Denotes a Relational operator node in the expression tree. Relational
|
100
100
|
# operators represent iterative processing of rows during query execution.
|
101
|
-
# For example, a
|
101
|
+
# For example, a `TableScan` operation that reads rows from a table.
|
102
102
|
RELATIONAL = 1
|
103
103
|
|
104
104
|
# Denotes a Scalar node in the expression tree. Scalar nodes represent
|
@@ -113,8 +113,8 @@ module Google
|
|
113
113
|
# @!attribute [rw] plan_nodes
|
114
114
|
# @return [Array<Google::Spanner::V1::PlanNode>]
|
115
115
|
# The nodes in the query plan. Plan nodes are returned in pre-order starting
|
116
|
-
# with the plan root. Each {Google::Spanner::V1::PlanNode PlanNode}'s
|
117
|
-
#
|
116
|
+
# with the plan root. Each {Google::Spanner::V1::PlanNode PlanNode}'s `id` corresponds to its index in
|
117
|
+
# `plan_nodes`.
|
118
118
|
class QueryPlan; end
|
119
119
|
end
|
120
120
|
end
|
@@ -23,7 +23,7 @@ module Google
|
|
23
23
|
# Metadata about the result set, such as row type information.
|
24
24
|
# @!attribute [rw] rows
|
25
25
|
# @return [Array<Google::Protobuf::ListValue>]
|
26
|
-
# Each element in
|
26
|
+
# Each element in `rows` is a row whose format is defined by
|
27
27
|
# {Google::Spanner::V1::ResultSetMetadata#row_type metadata::row_type}. The ith element
|
28
28
|
# in each row matches the ith field in
|
29
29
|
# {Google::Spanner::V1::ResultSetMetadata#row_type metadata::row_type}. Elements are
|
@@ -31,8 +31,13 @@ module Google
|
|
31
31
|
# {Google::Spanner::V1::TypeCode here}.
|
32
32
|
# @!attribute [rw] stats
|
33
33
|
# @return [Google::Spanner::V1::ResultSetStats]
|
34
|
-
# Query plan and execution statistics for the
|
35
|
-
# result set. These can be requested by setting
|
34
|
+
# Query plan and execution statistics for the SQL statement that
|
35
|
+
# produced this result set. These can be requested by setting
|
36
|
+
# {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
|
37
|
+
# DML statements always produce stats containing the number of rows
|
38
|
+
# modified, unless executed using the
|
39
|
+
# {Google::Spanner::V1::ExecuteSqlRequest::QueryMode::PLAN ExecuteSqlRequest::QueryMode::PLAN} {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
|
40
|
+
# Other fields may or may not be populated, based on the
|
36
41
|
# {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode}.
|
37
42
|
class ResultSet; end
|
38
43
|
|
@@ -46,7 +51,7 @@ module Google
|
|
46
51
|
# @!attribute [rw] values
|
47
52
|
# @return [Array<Google::Protobuf::Value>]
|
48
53
|
# A streamed result set consists of a stream of values, which might
|
49
|
-
# be split into many
|
54
|
+
# be split into many `PartialResultSet` messages to accommodate
|
50
55
|
# large rows and/or large values. Every N complete values defines a
|
51
56
|
# row, where N is equal to the number of entries in
|
52
57
|
# {Google::Spanner::V1::StructType#fields metadata::row_type::fields}.
|
@@ -56,16 +61,16 @@ module Google
|
|
56
61
|
#
|
57
62
|
# It is possible that the last value in values is "chunked",
|
58
63
|
# meaning that the rest of the value is sent in subsequent
|
59
|
-
#
|
64
|
+
# `PartialResultSet`(s). This is denoted by the {Google::Spanner::V1::PartialResultSet#chunked_value chunked_value}
|
60
65
|
# field. Two or more chunked values can be merged to form a
|
61
66
|
# complete value as follows:
|
62
67
|
#
|
63
|
-
# *
|
64
|
-
# *
|
65
|
-
# *
|
66
|
-
#
|
68
|
+
# * `bool/number/null`: cannot be chunked
|
69
|
+
# * `string`: concatenate the strings
|
70
|
+
# * `list`: concatenate the lists. If the last element in a list is a
|
71
|
+
# `string`, `list`, or `object`, merge it with the first element in
|
67
72
|
# the next list by applying these rules recursively.
|
68
|
-
# *
|
73
|
+
# * `object`: concatenate the (field name, field value) pairs. If a
|
69
74
|
# field name is duplicated, then apply these rules recursively
|
70
75
|
# to merge the field values.
|
71
76
|
#
|
@@ -97,7 +102,7 @@ module Google
|
|
97
102
|
#
|
98
103
|
# For a more complete example, suppose a streaming SQL query is
|
99
104
|
# yielding a result set whose rows contain a single string
|
100
|
-
# field. The following
|
105
|
+
# field. The following `PartialResultSet`s might be yielded:
|
101
106
|
#
|
102
107
|
# {
|
103
108
|
# "metadata": { ... }
|
@@ -115,35 +120,37 @@ module Google
|
|
115
120
|
# "resume_token": "Zx1B..."
|
116
121
|
# }
|
117
122
|
#
|
118
|
-
# This sequence of
|
119
|
-
# containing the field value
|
120
|
-
# field value
|
123
|
+
# This sequence of `PartialResultSet`s encodes two rows, one
|
124
|
+
# containing the field value `"Hello"`, and a second containing the
|
125
|
+
# field value `"World" = "W" + "orl" + "d"`.
|
121
126
|
# @!attribute [rw] chunked_value
|
122
127
|
# @return [true, false]
|
123
128
|
# If true, then the final value in {Google::Spanner::V1::PartialResultSet#values values} is chunked, and must
|
124
|
-
# be combined with more values from subsequent
|
129
|
+
# be combined with more values from subsequent `PartialResultSet`s
|
125
130
|
# to obtain a complete field value.
|
126
131
|
# @!attribute [rw] resume_token
|
127
132
|
# @return [String]
|
128
133
|
# Streaming calls might be interrupted for a variety of reasons, such
|
129
134
|
# as TCP connection loss. If this occurs, the stream of results can
|
130
135
|
# be resumed by re-sending the original request and including
|
131
|
-
#
|
136
|
+
# `resume_token`. Note that executing any other transaction in the
|
132
137
|
# same session invalidates the token.
|
133
138
|
# @!attribute [rw] stats
|
134
139
|
# @return [Google::Spanner::V1::ResultSetStats]
|
135
|
-
# Query plan and execution statistics for the
|
140
|
+
# Query plan and execution statistics for the statement that produced this
|
136
141
|
# streaming result set. These can be requested by setting
|
137
142
|
# {Google::Spanner::V1::ExecuteSqlRequest#query_mode ExecuteSqlRequest#query_mode} and are sent
|
138
143
|
# only once with the last response in the stream.
|
144
|
+
# This field will also be present in the last response for DML
|
145
|
+
# statements.
|
139
146
|
class PartialResultSet; end
|
140
147
|
|
141
148
|
# Metadata about a {Google::Spanner::V1::ResultSet ResultSet} or {Google::Spanner::V1::PartialResultSet PartialResultSet}.
|
142
149
|
# @!attribute [rw] row_type
|
143
150
|
# @return [Google::Spanner::V1::StructType]
|
144
151
|
# Indicates the field names and types for the rows in the result
|
145
|
-
# set. For example, a SQL query like
|
146
|
-
# Users"
|
152
|
+
# set. For example, a SQL query like `"SELECT UserId, UserName FROM
|
153
|
+
# Users"` could return a `row_type` value like:
|
147
154
|
#
|
148
155
|
# "fields": [
|
149
156
|
# { "name": "UserId", "type": { "code": "INT64" } },
|
@@ -170,6 +177,13 @@ module Google
|
|
170
177
|
# "elapsed_time": "1.22 secs",
|
171
178
|
# "cpu_time": "1.19 secs"
|
172
179
|
# }
|
180
|
+
# @!attribute [rw] row_count_exact
|
181
|
+
# @return [Integer]
|
182
|
+
# Standard DML returns an exact count of rows that were modified.
|
183
|
+
# @!attribute [rw] row_count_lower_bound
|
184
|
+
# @return [Integer]
|
185
|
+
# Partitioned DML does not offer exactly-once semantics, so it
|
186
|
+
# returns a lower bound of the rows modified.
|
173
187
|
class ResultSetStats; end
|
174
188
|
end
|
175
189
|
end
|
@@ -35,9 +35,9 @@ module Google
|
|
35
35
|
# The labels for the session.
|
36
36
|
#
|
37
37
|
# * Label keys must be between 1 and 63 characters long and must conform to
|
38
|
-
# the following regular expression:
|
38
|
+
# the following regular expression: `[a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?`.
|
39
39
|
# * Label values must be between 0 and 63 characters long and must conform
|
40
|
-
# to the regular expression
|
40
|
+
# to the regular expression `([a-z](https://cloud.google.com[-a-z0-9]*[a-z0-9])?)?`.
|
41
41
|
# * No more than 64 labels can be associated with a given session.
|
42
42
|
#
|
43
43
|
# See https://goo.gl/xmQnxf for more information on and examples of labels.
|
@@ -66,7 +66,7 @@ module Google
|
|
66
66
|
# to the server's maximum allowed page size.
|
67
67
|
# @!attribute [rw] page_token
|
68
68
|
# @return [String]
|
69
|
-
# If non-empty,
|
69
|
+
# If non-empty, `page_token` should contain a
|
70
70
|
# {Google::Spanner::V1::ListSessionsResponse#next_page_token next_page_token} from a previous
|
71
71
|
# {Google::Spanner::V1::ListSessionsResponse ListSessionsResponse}.
|
72
72
|
# @!attribute [rw] filter
|
@@ -74,12 +74,12 @@ module Google
|
|
74
74
|
# An expression for filtering the results of the request. Filter rules are
|
75
75
|
# case insensitive. The fields eligible for filtering are:
|
76
76
|
#
|
77
|
-
# *
|
77
|
+
# * `labels.key` where key is the name of a label
|
78
78
|
#
|
79
79
|
# Some examples of using filters are:
|
80
80
|
#
|
81
|
-
# *
|
82
|
-
# *
|
81
|
+
# * `labels.env:*` --> The session has the label "env".
|
82
|
+
# * `labels.env:dev` --> The session has the label "env" and the value of
|
83
83
|
# the label contains the string "dev".
|
84
84
|
class ListSessionsRequest; end
|
85
85
|
|
@@ -89,7 +89,7 @@ module Google
|
|
89
89
|
# The list of requested sessions.
|
90
90
|
# @!attribute [rw] next_page_token
|
91
91
|
# @return [String]
|
92
|
-
#
|
92
|
+
# `next_page_token` can be sent in a subsequent
|
93
93
|
# {Google::Spanner::V1::Spanner::ListSessions ListSessions} call to fetch more of the matching
|
94
94
|
# sessions.
|
95
95
|
class ListSessionsResponse; end
|
@@ -109,41 +109,52 @@ module Google
|
|
109
109
|
# @return [Google::Spanner::V1::TransactionSelector]
|
110
110
|
# The transaction to use. If none is provided, the default is a
|
111
111
|
# temporary read-only transaction with strong concurrency.
|
112
|
+
#
|
113
|
+
# The transaction to use.
|
114
|
+
#
|
115
|
+
# For queries, if none is provided, the default is a temporary read-only
|
116
|
+
# transaction with strong concurrency.
|
117
|
+
#
|
118
|
+
# Standard DML statements require a ReadWrite transaction. Single-use
|
119
|
+
# transactions are not supported (to avoid replay). The caller must
|
120
|
+
# either supply an existing transaction ID or begin a new transaction.
|
121
|
+
#
|
122
|
+
# Partitioned DML requires an existing PartitionedDml transaction ID.
|
112
123
|
# @!attribute [rw] sql
|
113
124
|
# @return [String]
|
114
|
-
# Required. The SQL
|
125
|
+
# Required. The SQL string.
|
115
126
|
# @!attribute [rw] params
|
116
127
|
# @return [Google::Protobuf::Struct]
|
117
|
-
# The SQL
|
118
|
-
# placeholder consists of
|
128
|
+
# The SQL string can contain parameter placeholders. A parameter
|
129
|
+
# placeholder consists of `'@'` followed by the parameter
|
119
130
|
# name. Parameter names consist of any combination of letters,
|
120
131
|
# numbers, and underscores.
|
121
132
|
#
|
122
133
|
# Parameters can appear anywhere that a literal value is expected. The same
|
123
134
|
# parameter name can be used more than once, for example:
|
124
|
-
#
|
135
|
+
# `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
125
136
|
#
|
126
|
-
# It is an error to execute an SQL
|
137
|
+
# It is an error to execute an SQL statement with unbound parameters.
|
127
138
|
#
|
128
|
-
# Parameter values are specified using
|
139
|
+
# Parameter values are specified using `params`, which is a JSON
|
129
140
|
# object whose keys are parameter names, and whose values are the
|
130
141
|
# corresponding parameter values.
|
131
142
|
# @!attribute [rw] param_types
|
132
143
|
# @return [Hash{String => Google::Spanner::V1::Type}]
|
133
144
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
134
|
-
# from a JSON value. For example, values of type
|
135
|
-
# of type
|
145
|
+
# from a JSON value. For example, values of type `BYTES` and values
|
146
|
+
# of type `STRING` both appear in {Google::Spanner::V1::ExecuteSqlRequest#params params} as JSON strings.
|
136
147
|
#
|
137
|
-
# In these cases,
|
138
|
-
# SQL type for some or all of the SQL
|
148
|
+
# In these cases, `param_types` can be used to specify the exact
|
149
|
+
# SQL type for some or all of the SQL statement parameters. See the
|
139
150
|
# definition of {Google::Spanner::V1::Type Type} for more information
|
140
151
|
# about SQL types.
|
141
152
|
# @!attribute [rw] resume_token
|
142
153
|
# @return [String]
|
143
|
-
# If this request is resuming a previously interrupted SQL
|
144
|
-
# execution,
|
154
|
+
# If this request is resuming a previously interrupted SQL statement
|
155
|
+
# execution, `resume_token` should be copied from the last
|
145
156
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
146
|
-
# enables the new SQL
|
157
|
+
# enables the new SQL statement execution to resume where the last one left
|
147
158
|
# off. The rest of the request parameters must exactly match the
|
148
159
|
# request that yielded this token.
|
149
160
|
# @!attribute [rw] query_mode
|
@@ -157,19 +168,30 @@ module Google
|
|
157
168
|
# previously created using PartitionQuery(). There must be an exact
|
158
169
|
# match for the values of fields common to this message and the
|
159
170
|
# PartitionQueryRequest message used to create this partition_token.
|
171
|
+
# @!attribute [rw] seqno
|
172
|
+
# @return [Integer]
|
173
|
+
# A per-transaction sequence number used to identify this request. This
|
174
|
+
# makes each request idempotent such that if the request is received multiple
|
175
|
+
# times, at most one will succeed.
|
176
|
+
#
|
177
|
+
# The sequence number must be monotonically increasing within the
|
178
|
+
# transaction. If a request arrives for the first time with an out-of-order
|
179
|
+
# sequence number, the transaction may be aborted. Replays of previously
|
180
|
+
# handled requests will yield the same response as the first execution.
|
181
|
+
#
|
182
|
+
# Required for DML statements. Ignored for queries.
|
160
183
|
class ExecuteSqlRequest
|
161
|
-
# Mode in which the
|
184
|
+
# Mode in which the statement must be processed.
|
162
185
|
module QueryMode
|
163
|
-
# The default mode
|
164
|
-
# about the query plan is returned.
|
186
|
+
# The default mode. Only the statement results are returned.
|
165
187
|
NORMAL = 0
|
166
188
|
|
167
|
-
# This mode returns only the query plan, without any
|
189
|
+
# This mode returns only the query plan, without any results or
|
168
190
|
# execution statistics information.
|
169
191
|
PLAN = 1
|
170
192
|
|
171
193
|
# This mode returns both the query plan and the execution statistics along
|
172
|
-
# with the
|
194
|
+
# with the results.
|
173
195
|
PROFILE = 2
|
174
196
|
end
|
175
197
|
end
|
@@ -212,29 +234,33 @@ module Google
|
|
212
234
|
# union operator conceptually divides one or more tables into multiple
|
213
235
|
# splits, remotely evaluates a subquery independently on each split, and
|
214
236
|
# then unions all results.
|
237
|
+
#
|
238
|
+
# This must not contain DML commands, such as INSERT, UPDATE, or
|
239
|
+
# DELETE. Use {Google::Spanner::V1::Spanner::ExecuteStreamingSql ExecuteStreamingSql} with a
|
240
|
+
# PartitionedDml transaction for large, partition-friendly DML operations.
|
215
241
|
# @!attribute [rw] params
|
216
242
|
# @return [Google::Protobuf::Struct]
|
217
243
|
# The SQL query string can contain parameter placeholders. A parameter
|
218
|
-
# placeholder consists of
|
244
|
+
# placeholder consists of `'@'` followed by the parameter
|
219
245
|
# name. Parameter names consist of any combination of letters,
|
220
246
|
# numbers, and underscores.
|
221
247
|
#
|
222
248
|
# Parameters can appear anywhere that a literal value is expected. The same
|
223
249
|
# parameter name can be used more than once, for example:
|
224
|
-
#
|
250
|
+
# `"WHERE id > @msg_id AND id < @msg_id + 100"`
|
225
251
|
#
|
226
252
|
# It is an error to execute an SQL query with unbound parameters.
|
227
253
|
#
|
228
|
-
# Parameter values are specified using
|
254
|
+
# Parameter values are specified using `params`, which is a JSON
|
229
255
|
# object whose keys are parameter names, and whose values are the
|
230
256
|
# corresponding parameter values.
|
231
257
|
# @!attribute [rw] param_types
|
232
258
|
# @return [Hash{String => Google::Spanner::V1::Type}]
|
233
259
|
# It is not always possible for Cloud Spanner to infer the right SQL type
|
234
|
-
# from a JSON value. For example, values of type
|
235
|
-
# of type
|
260
|
+
# from a JSON value. For example, values of type `BYTES` and values
|
261
|
+
# of type `STRING` both appear in {Google::Spanner::V1::PartitionQueryRequest#params params} as JSON strings.
|
236
262
|
#
|
237
|
-
# In these cases,
|
263
|
+
# In these cases, `param_types` can be used to specify the exact
|
238
264
|
# SQL type for some or all of the SQL query parameters. See the
|
239
265
|
# definition of {Google::Spanner::V1::Type Type} for more information
|
240
266
|
# about SQL types.
|
@@ -265,12 +291,12 @@ module Google
|
|
265
291
|
# this request.
|
266
292
|
# @!attribute [rw] key_set
|
267
293
|
# @return [Google::Spanner::V1::KeySet]
|
268
|
-
# Required.
|
294
|
+
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
269
295
|
# primary keys of the rows in {Google::Spanner::V1::PartitionReadRequest#table table} to be yielded, unless {Google::Spanner::V1::PartitionReadRequest#index index}
|
270
296
|
# is present. If {Google::Spanner::V1::PartitionReadRequest#index index} is present, then {Google::Spanner::V1::PartitionReadRequest#key_set key_set} instead names
|
271
297
|
# index keys in {Google::Spanner::V1::PartitionReadRequest#index index}.
|
272
298
|
#
|
273
|
-
# It is not an error for the
|
299
|
+
# It is not an error for the `key_set` to name rows that do not
|
274
300
|
# exist in the database. Read yields nothing for nonexistent rows.
|
275
301
|
# @!attribute [rw] partition_options
|
276
302
|
# @return [Google::Spanner::V1::PartitionOptions]
|
@@ -319,7 +345,7 @@ module Google
|
|
319
345
|
# this request.
|
320
346
|
# @!attribute [rw] key_set
|
321
347
|
# @return [Google::Spanner::V1::KeySet]
|
322
|
-
# Required.
|
348
|
+
# Required. `key_set` identifies the rows to be yielded. `key_set` names the
|
323
349
|
# primary keys of the rows in {Google::Spanner::V1::ReadRequest#table table} to be yielded, unless {Google::Spanner::V1::ReadRequest#index index}
|
324
350
|
# is present. If {Google::Spanner::V1::ReadRequest#index index} is present, then {Google::Spanner::V1::ReadRequest#key_set key_set} instead names
|
325
351
|
# index keys in {Google::Spanner::V1::ReadRequest#index index}.
|
@@ -329,17 +355,17 @@ module Google
|
|
329
355
|
# (if {Google::Spanner::V1::ReadRequest#index index} is non-empty). If the {Google::Spanner::V1::ReadRequest#partition_token partition_token} field is not
|
330
356
|
# empty, rows will be yielded in an unspecified order.
|
331
357
|
#
|
332
|
-
# It is not an error for the
|
358
|
+
# It is not an error for the `key_set` to name rows that do not
|
333
359
|
# exist in the database. Read yields nothing for nonexistent rows.
|
334
360
|
# @!attribute [rw] limit
|
335
361
|
# @return [Integer]
|
336
|
-
# If greater than zero, only the first
|
362
|
+
# If greater than zero, only the first `limit` rows are yielded. If `limit`
|
337
363
|
# is zero, the default is no limit. A limit cannot be specified if
|
338
|
-
#
|
364
|
+
# `partition_token` is set.
|
339
365
|
# @!attribute [rw] resume_token
|
340
366
|
# @return [String]
|
341
367
|
# If this request is resuming a previously interrupted read,
|
342
|
-
#
|
368
|
+
# `resume_token` should be copied from the last
|
343
369
|
# {Google::Spanner::V1::PartialResultSet PartialResultSet} yielded before the interruption. Doing this
|
344
370
|
# enables the new read to resume where the last read left off. The
|
345
371
|
# rest of the request parameters must exactly match the request
|
@@ -373,7 +399,7 @@ module Google
|
|
373
399
|
# Execute mutations in a temporary transaction. Note that unlike
|
374
400
|
# commit of a previously-started transaction, commit with a
|
375
401
|
# temporary transaction is non-idempotent. That is, if the
|
376
|
-
#
|
402
|
+
# `CommitRequest` is sent to Cloud Spanner more than once (for
|
377
403
|
# instance, due to retries in the application, or in the
|
378
404
|
# transport library), it is possible that the mutations are
|
379
405
|
# executed more than once. If this is undesirable, use
|