Skip to content

Commit ec87c08

Browse files
feat: add max_commit_delay API (#1078)
* feat(spanner): add proto and enum types PiperOrigin-RevId: 599046867 Source-Link: googleapis/googleapis@64a5bfe Source-Link: googleapis/googleapis-gen@6e96ab8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmU5NmFiOGJiMWVjNDUzNmM1YTBjNGQwOTVmNTNjZTA1NzhjYjhhNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add max_commit_delay API PiperOrigin-RevId: 599315735 Source-Link: googleapis/googleapis@465a103 Source-Link: googleapis/googleapis-gen@930e231 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwZTIzMThhY2JkMTBmYjU0ZDg2NjhkMmYyY2YxOWZlNDEzZDVhOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Sri Harsha CH <[email protected]>
1 parent 6640888 commit ec87c08

6 files changed

+36
-4
lines changed

google/cloud/spanner_v1/types/spanner.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from google.cloud.spanner_v1.types import result_set
2525
from google.cloud.spanner_v1.types import transaction as gs_transaction
2626
from google.cloud.spanner_v1.types import type as gs_type
27+
from google.protobuf import duration_pb2 # type: ignore
2728
from google.protobuf import struct_pb2 # type: ignore
2829
from google.protobuf import timestamp_pb2 # type: ignore
2930
from google.rpc import status_pb2 # type: ignore
@@ -1434,6 +1435,14 @@ class CommitRequest(proto.Message):
14341435
be included in the
14351436
[CommitResponse][google.spanner.v1.CommitResponse.commit_stats].
14361437
Default value is ``false``.
1438+
max_commit_delay (google.protobuf.duration_pb2.Duration):
1439+
Optional. The amount of latency this request
1440+
is willing to incur in order to improve
1441+
throughput. If this field is not set, Spanner
1442+
assumes requests are relatively latency
1443+
sensitive and automatically determines an
1444+
appropriate delay time. You can specify a
1445+
batching delay value between 0 and 500 ms.
14371446
request_options (google.cloud.spanner_v1.types.RequestOptions):
14381447
Common options for this request.
14391448
"""
@@ -1462,6 +1471,11 @@ class CommitRequest(proto.Message):
14621471
proto.BOOL,
14631472
number=5,
14641473
)
1474+
max_commit_delay: duration_pb2.Duration = proto.Field(
1475+
proto.MESSAGE,
1476+
number=8,
1477+
message=duration_pb2.Duration,
1478+
)
14651479
request_options: "RequestOptions" = proto.Field(
14661480
proto.MESSAGE,
14671481
number=6,

google/cloud/spanner_v1/types/type.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ class TypeCode(proto.Enum):
9494
- Members of a JSON object are not guaranteed to have their
9595
order preserved.
9696
- JSON array elements will have their order preserved.
97+
PROTO (13):
98+
Encoded as a base64-encoded ``string``, as described in RFC
99+
4648, section 4.
100+
ENUM (14):
101+
Encoded as ``string``, in decimal format.
97102
"""
98103
TYPE_CODE_UNSPECIFIED = 0
99104
BOOL = 1
@@ -107,6 +112,8 @@ class TypeCode(proto.Enum):
107112
STRUCT = 9
108113
NUMERIC = 10
109114
JSON = 11
115+
PROTO = 13
116+
ENUM = 14
110117

111118

112119
class TypeAnnotationCode(proto.Enum):
@@ -179,6 +186,13 @@ class Type(proto.Message):
179186
typically is not needed to process the content of a value
180187
(it doesn't affect serialization) and clients can ignore it
181188
on the read path.
189+
proto_type_fqn (str):
190+
If [code][google.spanner.v1.Type.code] ==
191+
[PROTO][google.spanner.v1.TypeCode.PROTO] or
192+
[code][google.spanner.v1.Type.code] ==
193+
[ENUM][google.spanner.v1.TypeCode.ENUM], then
194+
``proto_type_fqn`` is the fully qualified name of the proto
195+
type representing the proto/enum definition.
182196
"""
183197

184198
code: "TypeCode" = proto.Field(
@@ -201,6 +215,10 @@ class Type(proto.Message):
201215
number=4,
202216
enum="TypeAnnotationCode",
203217
)
218+
proto_type_fqn: str = proto.Field(
219+
proto.STRING,
220+
number=5,
221+
)
204222

205223

206224
class StructType(proto.Message):

samples/generated_samples/snippet_metadata_google.spanner.admin.database.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-spanner-admin-database",
11-
"version": "3.41.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.spanner.admin.instance.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-spanner-admin-instance",
11-
"version": "3.41.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.spanner.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-spanner",
11-
"version": "3.41.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

scripts/fixup_spanner_v1_keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class spannerCallTransformer(cst.CSTTransformer):
4242
'batch_create_sessions': ('database', 'session_count', 'session_template', ),
4343
'batch_write': ('session', 'mutation_groups', 'request_options', ),
4444
'begin_transaction': ('session', 'options', 'request_options', ),
45-
'commit': ('session', 'transaction_id', 'single_use_transaction', 'mutations', 'return_commit_stats', 'request_options', ),
45+
'commit': ('session', 'transaction_id', 'single_use_transaction', 'mutations', 'return_commit_stats', 'max_commit_delay', 'request_options', ),
4646
'create_session': ('database', 'session', ),
4747
'delete_session': ('name', ),
4848
'execute_batch_dml': ('session', 'transaction', 'statements', 'seqno', 'request_options', ),

0 commit comments

Comments
 (0)