Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

olavloite
Copy link
Contributor

Adds support for inline-begin in the mock server.

@olavloite olavloite requested review from a team as code owners December 16, 2024 17:12
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/python-spanner API. labels Dec 16, 2024
@olavloite olavloite requested review from aakashanandg and removed request for harshachinta December 20, 2024 10:16
partials.append(partial)
partials[len(partials) - 1].stats = result.stats
if started_transaction:
partials[0].metadata.transaction = started_transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason we're including the transaction object details with the first partial result set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is how the Spanner API works:

  1. The first PartialResultSet in a stream should always contain the metadata for the query result. The remaining PartialResultSets will not have this field set.
  2. If the request (e.g. the ExecuteSqlRequest) contained a BeginTransaction option, then the metadata should also include the transaction ID of the transaction that was started as a side-effect of executing the request.

See https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.TransactionSelector for a bit more background information.

Copy link
Contributor

@aakashanandg aakashanandg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just added a question for clarification on why we're including the transaction details with only a single partial result set

@olavloite olavloite merged commit 6352dd2 into main Dec 20, 2024
13 of 15 checks passed
@olavloite olavloite deleted the support-inline-begin-in-mock-server branch December 20, 2024 14:29
aakashanandg pushed a commit to aakashanandg/python-spanner that referenced this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants