Skip to content

feat(spanner): samples to set transaction options#1777

Open
skuruppu wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
skuruppu:spanner-txn-options-samples
Open

feat(spanner): samples to set transaction options#1777
skuruppu wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
skuruppu:spanner-txn-options-samples

Conversation

@skuruppu
Copy link
Copy Markdown
Contributor

@skuruppu skuruppu commented Apr 9, 2026

Adds samples that show how to set the isolation level and read lock mode at the Spanner client level and at a transaction level. If it's set at the client level, all RW transactions will set this value. The transaction-level setting allows users to override the client-level setting or to set the values for specific transactions.

@skuruppu skuruppu requested review from a team as code owners April 9, 2026 08:18
@snippet-bot
Copy link
Copy Markdown

snippet-bot bot commented Apr 9, 2026

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples. labels Apr 9, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two new Ruby Spanner examples: one demonstrating how to configure isolation levels and another for read lock modes. Both examples illustrate setting these options at the client level and overriding them at the transaction level. Corresponding RSpec tests have been added for these new functionalities. The review comments correctly identify a critical issue in both test files where the database schema is redundantly created, which would cause the tests to fail. This can be resolved by removing the duplicate db.update calls in the test setup.

Adds samples that show how to set the isolation level and read lock mode
at the Spanner client level and at a transaction level. If it's set at
the client level, all RW transactions will set this value. The
transaction-level setting allows users to override the client-level
setting or to set the values for specific transactions.
@skuruppu skuruppu force-pushed the spanner-txn-options-samples branch from c1b9909 to ee2f09c Compare April 9, 2026 11:50
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 Spanner API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant