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

fix(db_api): add dummy lastrowid attribute #227

Merged
merged 1 commit into from Feb 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion google/cloud/spanner_dbapi/cursor.py
Expand Up @@ -56,6 +56,7 @@ def __init__(self, connection):
self._itr = None
self._result_set = None
self._row_count = _UNSET_COUNT
self.lastrowid = None
self.connection = connection
self._is_closed = False
# the currently running SQL statement results checksum
Expand Down Expand Up @@ -89,7 +90,10 @@ def description(self):
:rtype: tuple
:returns: A tuple of columns' information.
"""
if not (self._result_set and self._result_set.metadata):
if not self._result_set:
return None

if not getattr(self._result_set, "metadata", None):
return None

row_type = self._result_set.metadata.row_type
Expand Down