Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: support inline-begin in mock server #1271

Merged
merged 2 commits into from
Dec 20, 2024

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
partial.values.extend(row)
partials.append(partial)
partials[len(partials) - 1].stats = result.stats
if started_transaction:
partials[0].metadata.transaction = started_transaction

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

@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
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