Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix check errors, rename test file
  • Loading branch information
AlisskaPie committed Nov 25, 2020
commit f8a6c8002077a294be56f15fc1f47e2164d35ae4
3 changes: 3 additions & 0 deletions samples/samples/autocommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
def enable_autocommit_mode(instance_id, database_id):
"""Enables autocommit mode."""
# [START spanner_enable_autocommit_mode]
from google.cloud.spanner_dbapi.checksum import ResultsChecksum

connection = connect(instance_id, database_id)
connection.autocommit = True
print("Autocommit mode is enabled.")

cursor = connection.cursor()
cursor._checksum = ResultsChecksum()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does the user need to initialise a private variable? Can this not be initialised as part of the cursor factory?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review! And sorry for the delayed answer.
I've made an update and placed this part in the test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not quite what I meant. The sample now looks as I would expect but I'm unclear as to why you still need to set cursor._checksum in the test. Is there a reason that _checksum defaults to None? Could it be updated to ResultsChecksum() instead?


cursor.execute(
"""CREATE TABLE Singers (
Expand Down