Skip to content

Commit c689c2e

Browse files
fix: add description for transaction autocommit (#587)
1 parent 37801b1 commit c689c2e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • packages/django-google-spanner/django_spanner

packages/django-google-spanner/django_spanner/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def is_usable(self):
199199

200200
return True
201201

202+
# The usual way to start a transaction is to turn autocommit off.
203+
# Spanner DB API does not properly start a transaction when disabling
204+
# autocommit. To avoid this buggy behavior and to actually enter a new
205+
# transaction, an explicit SELECT 1 is required.
202206
def _start_transaction_under_autocommit(self):
203207
"""
204208
Start a transaction explicitly in autocommit mode.

0 commit comments

Comments
 (0)