Skip to content

Commit

Permalink
feat(spanner): add directed_read_option in spanner.proto (#1030)
Browse files Browse the repository at this point in the history
* feat(spanner): add directed_read_option in spanner.proto
docs(spanner): updated comment formatting

PiperOrigin-RevId: 578551679

Source-Link: googleapis/googleapis@7c80b96

Source-Link: googleapis/googleapis-gen@7b1172b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2IxMTcyYmE1ZTAyMGVhZWY3ZGU3NTA2MmE1NzZhMTFiOGUxMTdlNCJ9

* 🦉 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Nov 2, 2023
1 parent 2d59dd0 commit 84d662b
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 60 deletions.
45 changes: 24 additions & 21 deletions google/cloud/spanner_v1/services/spanner/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ async def sample_batch_create_sessions():
Returns:
google.cloud.spanner_v1.types.BatchCreateSessionsResponse:
The response for
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -1075,8 +1075,10 @@ async def sample_execute_batch_dml():
Returns:
google.cloud.spanner_v1.types.ExecuteBatchDmlResponse:
The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
of [ResultSet][google.spanner.v1.ResultSet] messages,
The response for
[ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
Contains a list of
[ResultSet][google.spanner.v1.ResultSet] messages,
one for each DML statement that has successfully
executed, in the same order as the statements in the
request. If a statement fails, the status in the
Expand All @@ -1086,34 +1088,35 @@ async def sample_execute_batch_dml():
following approach:
1. Check the status in the response message. The
[google.rpc.Code][google.rpc.Code] enum value OK
indicates that all statements were executed
successfully.
2. If the status was not OK, check the number of
result sets in the response. If the response
contains N
[ResultSet][google.spanner.v1.ResultSet] messages,
then statement N+1 in the request failed.
[google.rpc.Code][google.rpc.Code] enum value OK
indicates that all statements were executed
successfully. 2. If the status was not OK, check the
number of result sets in the response. If the
response contains N
[ResultSet][google.spanner.v1.ResultSet] messages,
then statement N+1 in the request failed.
Example 1:
- Request: 5 DML statements, all executed
successfully.
- Response: 5
[ResultSet][google.spanner.v1.ResultSet] messages,
with the status OK.
\* Response: 5
[ResultSet][google.spanner.v1.ResultSet] messages,
with the status OK.
Example 2:
- Request: 5 DML statements. The third statement has
a syntax error.
- Response: 2
[ResultSet][google.spanner.v1.ResultSet] messages,
and a syntax error (INVALID_ARGUMENT) status. The
number of [ResultSet][google.spanner.v1.ResultSet]
messages indicates that the third statement
failed, and the fourth and fifth statements were
not executed.
\* Response: 2
[ResultSet][google.spanner.v1.ResultSet] messages,
and a syntax error (INVALID_ARGUMENT) status. The
number of [ResultSet][google.spanner.v1.ResultSet]
messages indicates that the third statement failed,
and the fourth and fifth statements were not
executed.
"""
# Create or coerce a protobuf request object.
Expand Down
45 changes: 24 additions & 21 deletions google/cloud/spanner_v1/services/spanner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def sample_batch_create_sessions():
Returns:
google.cloud.spanner_v1.types.BatchCreateSessionsResponse:
The response for
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
[BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -1279,8 +1279,10 @@ def sample_execute_batch_dml():
Returns:
google.cloud.spanner_v1.types.ExecuteBatchDmlResponse:
The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
of [ResultSet][google.spanner.v1.ResultSet] messages,
The response for
[ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
Contains a list of
[ResultSet][google.spanner.v1.ResultSet] messages,
one for each DML statement that has successfully
executed, in the same order as the statements in the
request. If a statement fails, the status in the
Expand All @@ -1290,34 +1292,35 @@ def sample_execute_batch_dml():
following approach:
1. Check the status in the response message. The
[google.rpc.Code][google.rpc.Code] enum value OK
indicates that all statements were executed
successfully.
2. If the status was not OK, check the number of
result sets in the response. If the response
contains N
[ResultSet][google.spanner.v1.ResultSet] messages,
then statement N+1 in the request failed.
[google.rpc.Code][google.rpc.Code] enum value OK
indicates that all statements were executed
successfully. 2. If the status was not OK, check the
number of result sets in the response. If the
response contains N
[ResultSet][google.spanner.v1.ResultSet] messages,
then statement N+1 in the request failed.
Example 1:
- Request: 5 DML statements, all executed
successfully.
- Response: 5
[ResultSet][google.spanner.v1.ResultSet] messages,
with the status OK.
\* Response: 5
[ResultSet][google.spanner.v1.ResultSet] messages,
with the status OK.
Example 2:
- Request: 5 DML statements. The third statement has
a syntax error.
- Response: 2
[ResultSet][google.spanner.v1.ResultSet] messages,
and a syntax error (INVALID_ARGUMENT) status. The
number of [ResultSet][google.spanner.v1.ResultSet]
messages indicates that the third statement
failed, and the fourth and fifth statements were
not executed.
\* Response: 2
[ResultSet][google.spanner.v1.ResultSet] messages,
and a syntax error (INVALID_ARGUMENT) status. The
number of [ResultSet][google.spanner.v1.ResultSet]
messages indicates that the third statement failed,
and the fourth and fifth statements were not
executed.
"""
# Create or coerce a protobuf request object.
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/spanner_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
CommitRequest,
CreateSessionRequest,
DeleteSessionRequest,
DirectedReadOptions,
ExecuteBatchDmlRequest,
ExecuteBatchDmlResponse,
ExecuteSqlRequest,
Expand Down Expand Up @@ -89,6 +90,7 @@
"CommitRequest",
"CreateSessionRequest",
"DeleteSessionRequest",
"DirectedReadOptions",
"ExecuteBatchDmlRequest",
"ExecuteBatchDmlResponse",
"ExecuteSqlRequest",
Expand Down
Loading

0 comments on commit 84d662b

Please sign in to comment.