8000 fix: implementing suggested changes · MaxxleLLC/python-spanner-django@41abaeb · GitHub
[go: up one dir, main page]

Skip to content

Commit 41abaeb

Browse files
committed
fix: implementing suggested changes
1 parent 2a78830 commit 41abaeb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

google/cloud/spanner_dbapi/connection.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def autocommit(self):
5555

5656
@autocommit.setter
5757
def autocommit(self, value):
58-
"""Change this connection autocommit mode.
58+
"""Change this connection autocommit mode. Setting this value to True
59+
while a transaction is active will commit the current transaction.
5960
6061
:type value: bool
6162
:param value: New autocommit mode state.
@@ -152,15 +153,22 @@ def close(self):
152153
self.is_closed = True
153154

154155
def commit(self):
155-
"""Commits any pending transaction to the database."""
156+
"""Commits any pending transaction to the database.
157+
158+
This method is non-operational in autocommit mode.
159+
"""
156160
if self._autocommit:
157161
warnings.warn(AUTOCOMMIT_MODE_WARNING, UserWarning, stacklevel=2)
158162
elif self._transaction:
159163
self._transaction.commit()
160164
self._release_session()
161165

162166 6A93
def rollback(self):
163-
"""Rollback all the pending transactions."""
167+
"""Rolls back any pending transaction.
168+
169+
This is a no-op if there is no active transaction or if the connection
170+
is in autocommit mode.
171+
"""
164172
if self._autocommit:
165173
warnings.warn(AUTOCOMMIT_MODE_WARNING, UserWarning, stacklevel=2)
166174
elif self._transaction:

0 commit comments

Comments
 (0)
0