Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit f943cee

Browse files
committed
feat: Add support for multiplexed sessions - part 4a (precommit tokens)
- Add ingest of precommit tokens - Add precommit tokens to commit request Signed-off-by: currantw <taylor.curran@improving.com>
1 parent ce32445 commit f943cee

File tree

12 files changed

+1172
-795
lines changed

12 files changed

+1172
-795
lines changed

google/cloud/spanner_v1/batch.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ class _BatchBase(_SessionWrapper):
4646
:param session: the session used to perform the commit
4747
"""
4848

49-
transaction_tag = None
50-
_read_only = False
51-
5249
def __init__(self, session):
5350
super(_BatchBase, self).__init__(session)
5451
self._mutations = []
52+
self.transaction_tag: str = None
5553

5654
def _check_state(self):
5755
"""Helper for :meth:`commit` et al.

google/cloud/spanner_v1/database.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,23 @@ def execute_pdml():
770770

771771
return _retry_on_aborted(execute_pdml, DEFAULT_RETRY_BACKOFF)()
772772

773+
def session(self, labels=None, database_role=None):
774+
"""Deprecated. Factory to create a session for this database.
775+
776+
:type labels: dict (str -> str) or None
777+
:param labels: (Optional) user-assigned labels for the session.
778+
779+
:type database_role: str
780+
:param database_role: (Optional) user-assigned database_role for the session.
781+
782+
:rtype: :class:`~google.cloud.spanner_v1.session.Session`
783+
:returns: a session bound to this database.
784+
"""
785+
# If role is specified in param, then that role is used
786+
# instead.
787+
role = database_role or self._database_role
788+
return Session(self, labels=labels, database_role=role)
789+
773790
def snapshot(self, **kw):
774791
"""Return an object which wraps a snapshot.
775792

0 commit comments

Comments
 (0)