Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions google/cloud/spanner_v1/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ class _BatchBase(_SessionWrapper):
:param session: the session used to perform the commit
"""

transaction_tag = None
_read_only = False

def __init__(self, session):
super(_BatchBase, self).__init__(session)
self._mutations = []
self.transaction_tag: str = None

def _check_state(self):
"""Helper for :meth:`commit` et al.
Expand Down
17 changes: 17 additions & 0 deletions google/cloud/spanner_v1/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,23 @@ def execute_pdml():

return _retry_on_aborted(execute_pdml, DEFAULT_RETRY_BACKOFF)()

def session(self, labels=None, database_role=None):
"""Deprecated. Factory to create a session for this database.

:type labels: dict (str -> str) or None
:param labels: (Optional) user-assigned labels for the session.

:type database_role: str
:param database_role: (Optional) user-assigned database_role for the session.

:rtype: :class:`~google.cloud.spanner_v1.session.Session`
:returns: a session bound to this database.
"""
# If role is specified in param, then that role is used
# instead.
role = database_role or self._database_role
return Session(self, labels=labels, database_role=role)
Comment on lines +773 to +788
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.

Method is deprecated and should be removed.


def snapshot(self, **kw):
"""Return an object which wraps a snapshot.

Expand Down
Loading
Loading