Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit b5940f0

Browse files
1 parent bf0ad25 commit b5940f0

283 files changed

Lines changed: 44 additions & 129063 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/cloud/spanner_v1/types/result_set.py

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ class ResultSet(proto.Message):
6060
rows modified, unless executed using the
6161
[ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN]
6262
[ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
63-
Other fields may or may not be populated, based on the
63+
Other fields might or might not be populated, based on the
6464
[ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
6565
precommit_token (google.cloud.spanner_v1.types.MultiplexedSessionPrecommitToken):
66-
Optional. A precommit token will be included if the
67-
read-write transaction is on a multiplexed session. The
68-
precommit token with the highest sequence number from this
69-
transaction attempt should be passed to the
70-
[Commit][google.spanner.v1.Spanner.Commit] request for this
71-
transaction. This feature is not yet supported and will
72-
result in an UNIMPLEMENTED error.
66+
Optional. A precommit token is included if the read-write
67+
transaction is on a multiplexed session. Pass the precommit
68+
token with the highest sequence number from this transaction
69+
attempt to the [Commit][google.spanner.v1.Spanner.Commit]
70+
request for this transaction.
7371
"""
7472

7573
metadata: "ResultSetMetadata" = proto.Field(
@@ -115,14 +113,14 @@ class PartialResultSet(proto.Message):
115113
Most values are encoded based on type as described
116114
[here][google.spanner.v1.TypeCode].
117115
118-
It is possible that the last value in values is "chunked",
116+
It's possible that the last value in values is "chunked",
119117
meaning that the rest of the value is sent in subsequent
120118
``PartialResultSet``\ (s). This is denoted by the
121119
[chunked_value][google.spanner.v1.PartialResultSet.chunked_value]
122120
field. Two or more chunked values can be merged to form a
123121
complete value as follows:
124122
125-
- ``bool/number/null``: cannot be chunked
123+
- ``bool/number/null``: can't be chunked
126124
- ``string``: concatenate the strings
127125
- ``list``: concatenate the lists. If the last element in a
128126
list is a ``string``, ``list``, or ``object``, merge it
@@ -136,28 +134,28 @@ class PartialResultSet(proto.Message):
136134
137135
::
138136
139-
# Strings are concatenated.
137+
Strings are concatenated.
140138
"foo", "bar" => "foobar"
141139
142-
# Lists of non-strings are concatenated.
140+
Lists of non-strings are concatenated.
143141
[2, 3], [4] => [2, 3, 4]
144142
145-
# Lists are concatenated, but the last and first elements are merged
146-
# because they are strings.
143+
Lists are concatenated, but the last and first elements are merged
144+
because they are strings.
147145
["a", "b"], ["c", "d"] => ["a", "bc", "d"]
148146
149-
# Lists are concatenated, but the last and first elements are merged
150-
# because they are lists. Recursively, the last and first elements
151-
# of the inner lists are merged because they are strings.
147+
Lists are concatenated, but the last and first elements are merged
148+
because they are lists. Recursively, the last and first elements
149+
of the inner lists are merged because they are strings.
152150
["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"]
153151
154-
# Non-overlapping object fields are combined.
152+
Non-overlapping object fields are combined.
155153
{"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"}
156154
157-
# Overlapping object fields are merged.
155+
Overlapping object fields are merged.
158156
{"a": "1"}, {"a": "2"} => {"a": "12"}
159157
160-
# Examples of merging objects containing lists of strings.
158+
Examples of merging objects containing lists of strings.
161159
{"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]}
162160
163161
For a more complete example, suppose a streaming SQL query
@@ -176,7 +174,6 @@ class PartialResultSet(proto.Message):
176174
{
177175
"values": ["orl"]
178176
"chunked_value": true
179-
"resume_token": "Bqp2..."
180177
}
181178
{
182179
"values": ["d"]
@@ -186,6 +183,13 @@ class PartialResultSet(proto.Message):
186183
This sequence of ``PartialResultSet``\ s encodes two rows,
187184
one containing the field value ``"Hello"``, and a second
188185
containing the field value ``"World" = "W" + "orl" + "d"``.
186+
187+
Not all ``PartialResultSet``\ s contain a ``resume_token``.
188+
Execution can only be resumed from a previously yielded
189+
``resume_token``. For the above sequence of
190+
``PartialResultSet``\ s, resuming the query with
191+
``"resume_token": "Af65..."`` yields results from the
192+
``PartialResultSet`` with value "orl".
189193
chunked_value (bool):
190194
If true, then the final value in
191195
[values][google.spanner.v1.PartialResultSet.values] is
@@ -205,16 +209,20 @@ class PartialResultSet(proto.Message):
205209
by setting
206210
[ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]
207211
and are sent only once with the last response in the stream.
208-
This field will also be present in the last response for DML
212+
This field is also present in the last response for DML
209213
statements.
210214
precommit_token (google.cloud.spanner_v1.types.MultiplexedSessionPrecommitToken):
211-
Optional. A precommit token will be included if the
212-
read-write transaction is on a multiplexed session. The
215+
Optional. A precommit token is included if the read-write
216+
transaction has multiplexed sessions enabled. Pass the
213217
precommit token with the highest sequence number from this
214-
transaction attempt should be passed to the
218+
transaction attempt to the
215219
[Commit][google.spanner.v1.Spanner.Commit] request for this
216-
transaction. This feature is not yet supported and will
217-
result in an UNIMPLEMENTED error.
220+
transaction.
221+
last (bool):
222+
Optional. Indicates whether this is the last
223+
``PartialResultSet`` in the stream. The server might
224+
optionally set this field. Clients shouldn't rely on this
225+
field being set in all cases.
218226
"""
219227

220228
metadata: "ResultSetMetadata" = proto.Field(
@@ -245,6 +253,10 @@ class PartialResultSet(proto.Message):
245253
number=8,
246254
message=gs_transaction.MultiplexedSessionPrecommitToken,
247255
)
256+
last: bool = proto.Field(
257+
proto.BOOL,
258+
number=9,
259+
)
248260

249261

250262
class ResultSetMetadata(proto.Message):
@@ -335,7 +347,7 @@ class ResultSetStats(proto.Message):
335347
336348
This field is a member of `oneof`_ ``row_count``.
337349
row_count_lower_bound (int):
338-
Partitioned DML does not offer exactly-once
350+
Partitioned DML doesn't offer exactly-once
339351
semantics, so it returns a lower bound of the
340352
rows modified.
341353

owl-bot-staging/spanner/v1/.coveragerc

Lines changed: 0 additions & 13 deletions
This file was deleted.

owl-bot-staging/spanner/v1/.flake8

Lines changed: 0 additions & 33 deletions
This file was deleted.

owl-bot-staging/spanner/v1/MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

owl-bot-staging/spanner/v1/README.rst

Lines changed: 0 additions & 143 deletions
This file was deleted.

owl-bot-staging/spanner/v1/docs/_static/custom.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)