From 67af089a1245c0e6ea9c547dbaf1b89e26fd8336 Mon Sep 17 00:00:00 2001 From: Subham Sinha Date: Thu, 26 Mar 2026 13:20:45 +0530 Subject: [PATCH] docs(async): mark new AsyncIO APIs as experimental --- google/cloud/spanner_v1/_async/batch.py | 1 + google/cloud/spanner_v1/_async/client.py | 1 + google/cloud/spanner_v1/_async/database.py | 1 + google/cloud/spanner_v1/_async/instance.py | 1 + google/cloud/spanner_v1/_async/pool.py | 5 +++++ google/cloud/spanner_v1/_async/session.py | 1 + google/cloud/spanner_v1/_async/snapshot.py | 1 + google/cloud/spanner_v1/_async/streamed.py | 1 + google/cloud/spanner_v1/_async/transaction.py | 1 + google/cloud/spanner_v1/batch.py | 2 +- google/cloud/spanner_v1/database.py | 12 +++++++----- google/cloud/spanner_v1/pool.py | 12 +++++++----- google/cloud/spanner_v1/session.py | 8 ++++---- google/cloud/spanner_v1/snapshot.py | 6 +++--- google/cloud/spanner_v1/streamed.py | 8 ++++---- google/cloud/spanner_v1/transaction.py | 18 +++++++++--------- 16 files changed, 48 insertions(+), 31 deletions(-) diff --git a/google/cloud/spanner_v1/_async/batch.py b/google/cloud/spanner_v1/_async/batch.py index 680139714b..4cbbcf1ec4 100644 --- a/google/cloud/spanner_v1/_async/batch.py +++ b/google/cloud/spanner_v1/_async/batch.py @@ -50,6 +50,7 @@ DEFAULT_RETRY_TIMEOUT_SECS = 30 +# Experimental API - Please note that this API is currently experimental and can change in the future. class _BatchBase(_SessionWrapper): """Accumulate mutations for transmission during :meth:`commit`. diff --git a/google/cloud/spanner_v1/_async/client.py b/google/cloud/spanner_v1/_async/client.py index 28c8679aea..1ebfc2046b 100644 --- a/google/cloud/spanner_v1/_async/client.py +++ b/google/cloud/spanner_v1/_async/client.py @@ -167,6 +167,7 @@ def _initialize_metrics(project, credentials): ) +# Experimental API - Please note that this API is currently experimental and can change in the future. class Client(ClientWithProject): """Client for interacting with Cloud Spanner API. diff --git a/google/cloud/spanner_v1/_async/database.py b/google/cloud/spanner_v1/_async/database.py index 92f87cbbed..a6063bcb9e 100644 --- a/google/cloud/spanner_v1/_async/database.py +++ b/google/cloud/spanner_v1/_async/database.py @@ -115,6 +115,7 @@ DEFAULT_RETRY_BACKOFF = AsyncRetry(initial=0.02, maximum=32, multiplier=1.3) +# Experimental API - Please note that this API is currently experimental and can change in the future. class Database(object): """Representation of a Cloud Spanner Database. diff --git a/google/cloud/spanner_v1/_async/instance.py b/google/cloud/spanner_v1/_async/instance.py index 7aa4f8e560..92c75d2b35 100644 --- a/google/cloud/spanner_v1/_async/instance.py +++ b/google/cloud/spanner_v1/_async/instance.py @@ -81,6 +81,7 @@ def _type_string_to_type_pb(type_string): @CrossSync.convert_class(add_mapping_for_name="Instance") +# Experimental API - Please note that this API is currently experimental and can change in the future. class Instance(object): """Representation of a Cloud Spanner Instance. diff --git a/google/cloud/spanner_v1/_async/pool.py b/google/cloud/spanner_v1/_async/pool.py index 9a42e05c98..17692c5950 100644 --- a/google/cloud/spanner_v1/_async/pool.py +++ b/google/cloud/spanner_v1/_async/pool.py @@ -73,6 +73,7 @@ async def __aexit__(self, exc_type, exc_value, traceback): @CrossSync.convert_class +# Experimental API - Please note that this API is currently experimental and can change in the future. class AbstractSessionPool(object): """Specifies required API for concrete session pool implementations. @@ -209,6 +210,7 @@ def session(self, **kwargs): @CrossSync.convert_class +# Experimental API - Please note that this API is currently experimental and can change in the future. class FixedSizePool(AbstractSessionPool): """Concrete session pool implementation: @@ -475,6 +477,7 @@ async def clear(self): @CrossSync.convert_class +# Experimental API - Please note that this API is currently experimental and can change in the future. class BurstyPool(AbstractSessionPool): """Concrete session pool implementation: @@ -586,6 +589,7 @@ async def clear(self): @CrossSync.convert_class +# Experimental API - Please note that this API is currently experimental and can change in the future. class PingingPool(FixedSizePool): """Concrete session pool implementation: @@ -835,6 +839,7 @@ async def ping(self): @CrossSync.convert_class +# Experimental API - Please note that this API is currently experimental and can change in the future. class TransactionPingingPool(PingingPool): """Concrete session pool implementation: diff --git a/google/cloud/spanner_v1/_async/session.py b/google/cloud/spanner_v1/_async/session.py index 2aa686d408..91b0adb408 100644 --- a/google/cloud/spanner_v1/_async/session.py +++ b/google/cloud/spanner_v1/_async/session.py @@ -48,6 +48,7 @@ @total_ordering +# Experimental API - Please note that this API is currently experimental and can change in the future. class Session(object): """Representation of a Cloud Spanner Session. diff --git a/google/cloud/spanner_v1/_async/snapshot.py b/google/cloud/spanner_v1/_async/snapshot.py index 5ca7889545..e6abdedf35 100644 --- a/google/cloud/spanner_v1/_async/snapshot.py +++ b/google/cloud/spanner_v1/_async/snapshot.py @@ -776,6 +776,7 @@ def _update_for_precommit_token_pb_unsafe( self._precommit_token = precommit_token_pb +# Experimental API - Please note that this API is currently experimental and can change in the future. class Snapshot(_SnapshotBase): """Allow a set of reads / SQL statements with shared staleness.""" diff --git a/google/cloud/spanner_v1/_async/streamed.py b/google/cloud/spanner_v1/_async/streamed.py index eacca10c53..7c67bd5248 100644 --- a/google/cloud/spanner_v1/_async/streamed.py +++ b/google/cloud/spanner_v1/_async/streamed.py @@ -23,6 +23,7 @@ from google.cloud.spanner_v1.types.type import TypeCode +# Experimental API - Please note that this API is currently experimental and can change in the future. class StreamedResultSet(object): """Process a sequence of partial result sets into a single set of row data. diff --git a/google/cloud/spanner_v1/_async/transaction.py b/google/cloud/spanner_v1/_async/transaction.py index c9f5405d84..302cf01ef0 100644 --- a/google/cloud/spanner_v1/_async/transaction.py +++ b/google/cloud/spanner_v1/_async/transaction.py @@ -54,6 +54,7 @@ from google.cloud.spanner_v1.types.transaction import TransactionOptions +# Experimental API - Please note that this API is currently experimental and can change in the future. class Transaction(_SnapshotBase, _BatchBase): """Implement read-write transaction semantics for a session. diff --git a/google/cloud/spanner_v1/batch.py b/google/cloud/spanner_v1/batch.py index ebec36bc20..b783495766 100644 --- a/google/cloud/spanner_v1/batch.py +++ b/google/cloud/spanner_v1/batch.py @@ -243,7 +243,7 @@ def wrapped_method(): max_commit_delay=max_commit_delay, request_options=request_options, ) - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( getattr(database, "_next_nth_request", 0), 1, metadata, span ) commit_method = functools.partial( diff --git a/google/cloud/spanner_v1/database.py b/google/cloud/spanner_v1/database.py index c4be870609..e04868aa80 100644 --- a/google/cloud/spanner_v1/database.py +++ b/google/cloud/spanner_v1/database.py @@ -210,9 +210,11 @@ def __init__( def _resource_info(self): """Resource information for metrics labels.""" return { - "project": self._instance._client.project - if self._instance and self._instance._client - else None, + "project": ( + self._instance._client.project + if self._instance and self._instance._client + else None + ), "instance": self._instance.instance_id if self._instance else None, "database": self.database_id, } @@ -530,7 +532,7 @@ def with_error_augmentation( tuple: (metadata_list, context_manager)""" if span is None: span = get_current_span() - metadata, request_id = _metadata_with_request_id_and_req_id( + (metadata, request_id) = _metadata_with_request_id_and_req_id( self._nth_client_id, self._channel_id, nth_request, @@ -807,7 +809,7 @@ def execute_pdml(): session = self._sessions_manager.get_session(transaction_type) try: add_span_event(span, "Starting BeginTransaction") - call_metadata, error_augmenter = self.with_error_augmentation( + (call_metadata, error_augmenter) = self.with_error_augmentation( self._next_nth_request, 1, metadata, span ) with error_augmenter: diff --git a/google/cloud/spanner_v1/pool.py b/google/cloud/spanner_v1/pool.py index 4d17911da3..543db56e76 100644 --- a/google/cloud/spanner_v1/pool.py +++ b/google/cloud/spanner_v1/pool.py @@ -304,7 +304,7 @@ def _fill_pool(self): f"Creating {request.session_count} sessions", span_event_attributes, ) - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( database._next_nth_request, 1, metadata, span ) with error_augmenter: @@ -612,7 +612,7 @@ def bind(self, database): ) as span, MetricsCapture(self._resource_info): returned_session_count = 0 while returned_session_count < self.size: - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( database._next_nth_request, 1, metadata, span ) with error_augmenter: @@ -654,7 +654,7 @@ def get(self, timeout=None): ping_after = None session = None try: - ping_after, session = CrossSync._Sync_Impl.queue_get( + (ping_after, session) = CrossSync._Sync_Impl.queue_get( self._sessions, block=True, timeout=timeout ) except CrossSync._Sync_Impl.QueueEmpty as e: @@ -698,7 +698,9 @@ def clear(self): """Delete all sessions in the pool.""" while True: try: - _, session = CrossSync._Sync_Impl.queue_get(self._sessions, block=False) + (_, session) = CrossSync._Sync_Impl.queue_get( + self._sessions, block=False + ) except CrossSync._Sync_Impl.QueueEmpty: break else: @@ -711,7 +713,7 @@ def ping(self): or during the "idle" phase of an event loop.""" while True: try: - ping_after, session = CrossSync._Sync_Impl.queue_get( + (ping_after, session) = CrossSync._Sync_Impl.queue_get( self._sessions, block=False ) except CrossSync._Sync_Impl.QueueEmpty: diff --git a/google/cloud/spanner_v1/session.py b/google/cloud/spanner_v1/session.py index 82cb71fb9e..336c659669 100644 --- a/google/cloud/spanner_v1/session.py +++ b/google/cloud/spanner_v1/session.py @@ -188,7 +188,7 @@ def create(self): observability_options=observability_options, metadata=metadata, ) as span, MetricsCapture(self._resource_info): - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, 1, metadata, span ) with error_augmenter: @@ -232,7 +232,7 @@ def exists(self): observability_options=observability_options, metadata=metadata, ) as span, MetricsCapture(self._resource_info): - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, 1, metadata, span ) with error_augmenter: @@ -283,7 +283,7 @@ def delete(self): observability_options=observability_options, metadata=metadata, ) as span, MetricsCapture(self._resource_info): - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, 1, metadata, span ) with error_augmenter: @@ -300,7 +300,7 @@ def ping(self): metadata = _metadata_with_prefix(database.name) nth_request = database._next_nth_request with trace_call("CloudSpanner.Session.ping", self) as span: - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, 1, metadata, span ) with error_augmenter: diff --git a/google/cloud/spanner_v1/snapshot.py b/google/cloud/spanner_v1/snapshot.py index d7d7451775..533fb0aaa3 100644 --- a/google/cloud/spanner_v1/snapshot.py +++ b/google/cloud/spanner_v1/snapshot.py @@ -322,7 +322,7 @@ def execute_sql( raise ValueError("Transaction has not begun.") if params is not None: params_pb = Struct( - fields={key: _make_value_pb(value) for key, value in params.items()} + fields={key: _make_value_pb(value) for (key, value) in params.items()} ) else: params_pb = {} @@ -513,7 +513,7 @@ def partition_query( raise ValueError("Cannot partition a single-use transaction.") if params is not None: params_pb = Struct( - fields={key: _make_value_pb(value) for key, value in params.items()} + fields={key: _make_value_pb(value) for (key, value) in params.items()} ) else: params_pb = Struct() @@ -614,7 +614,7 @@ def wrapped_method(): begin_transaction_request = BeginTransactionRequest( **begin_request_kwargs ) - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, attempt.increment(), metadata, span ) begin_transaction_method = functools.partial( diff --git a/google/cloud/spanner_v1/streamed.py b/google/cloud/spanner_v1/streamed.py index 48630ef574..21bdc889ac 100644 --- a/google/cloud/spanner_v1/streamed.py +++ b/google/cloud/spanner_v1/streamed.py @@ -147,7 +147,7 @@ def _consume_next(self): def __iter__(self): while True: - iter_rows, self._rows[:] = (self._rows[:], ()) + (iter_rows, self._rows[:]) = (self._rows[:], ()) while iter_rows: yield iter_rows.pop(0) if self._done: @@ -230,7 +230,7 @@ def to_dict_list(self): rows.append( { column: value - for column, value in zip( + for (column, value) in zip( [column.name for column in self._metadata.row_type.fields], row ) } @@ -291,7 +291,7 @@ def _merge_array(lhs, rhs, type_): if element_type.code in _UNMERGEABLE_TYPES: lhs.list_value.values.extend(rhs.list_value.values) return lhs - lhs, rhs = (list(lhs.list_value.values), list(rhs.list_value.values)) + (lhs, rhs) = (list(lhs.list_value.values), list(rhs.list_value.values)) if not len(lhs) or not len(rhs): return Value(list_value=ListValue(values=lhs + rhs)) first = rhs.pop(0) @@ -316,7 +316,7 @@ def _merge_array(lhs, rhs, type_): def _merge_struct(lhs, rhs, type_): """Helper for '_merge_by_type'.""" fields = type_.struct_type.fields - lhs, rhs = (list(lhs.list_value.values), list(rhs.list_value.values)) + (lhs, rhs) = (list(lhs.list_value.values), list(rhs.list_value.values)) if not len(lhs) or not len(rhs): return Value(list_value=ListValue(values=lhs + rhs)) candidate_type = fields[len(lhs) - 1].type_ diff --git a/google/cloud/spanner_v1/transaction.py b/google/cloud/spanner_v1/transaction.py index 254604dfa6..9e14387ea8 100644 --- a/google/cloud/spanner_v1/transaction.py +++ b/google/cloud/spanner_v1/transaction.py @@ -162,7 +162,7 @@ def rollback(self) -> None: def wrapped_method(*args, **kwargs): attempt.increment() - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, attempt.value, metadata, span ) rollback_method = functools.partial( @@ -269,7 +269,7 @@ def wrapped_method(*args, **kwargs): is_multiplexed = getattr(self._session, "is_multiplexed", False) if is_multiplexed and self._precommit_token is not None: commit_request_args["precommit_token"] = self._precommit_token - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, attempt.value, metadata, span ) commit_method = functools.partial( @@ -300,7 +300,7 @@ def before_next_retry(nth_retry, delay_in_seconds): if commit_response_pb._pb.HasField("precommit_token"): add_span_event(span, commit_retry_event_name) nth_request = database._next_nth_request - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, 1, metadata, span ) with error_augmenter: @@ -338,7 +338,7 @@ def _make_params_pb(params, param_types): If ``params`` is None but ``param_types`` is not None.""" if params: return Struct( - fields={key: _make_value_pb(value) for key, value in params.items()} + fields={key: _make_value_pb(value) for (key, value) in params.items()} ) return {} @@ -417,7 +417,7 @@ def execute_update( metadata.append( _metadata_with_leader_aware_routing(database._route_to_leader_enabled) ) - seqno, self._execute_sql_request_count = ( + (seqno, self._execute_sql_request_count) = ( self._execute_sql_request_count, self._execute_sql_request_count + 1, ) @@ -454,7 +454,7 @@ def execute_update( def wrapped_method(*args, **kwargs): attempt.increment() - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, attempt.value, metadata ) execute_sql_method = functools.partial( @@ -544,7 +544,7 @@ def batch_update( if isinstance(statement, str): parsed.append(ExecuteBatchDmlRequest.Statement(sql=statement)) else: - dml, params, param_types = statement + (dml, params, param_types) = statement params_pb = self._make_params_pb(params, param_types) parsed.append( ExecuteBatchDmlRequest.Statement( @@ -556,7 +556,7 @@ def batch_update( metadata.append( _metadata_with_leader_aware_routing(database._route_to_leader_enabled) ) - seqno, self._execute_sql_request_count = ( + (seqno, self._execute_sql_request_count) = ( self._execute_sql_request_count, self._execute_sql_request_count + 1, ) @@ -590,7 +590,7 @@ def batch_update( def wrapped_method(*args, **kwargs): attempt.increment() - call_metadata, error_augmenter = database.with_error_augmentation( + (call_metadata, error_augmenter) = database.with_error_augmentation( nth_request, attempt.value, metadata ) execute_batch_dml_method = functools.partial(