1515from __future__ import annotations
1616
1717from typing import Sequence , TYPE_CHECKING
18- import functools
1918
2019from google .api_core import exceptions as core_exceptions
2120from google .api_core import retry as retries
21+ import google .cloud .bigtable_v2 .types .bigtable as types_pb
2222import google .cloud .bigtable .data .exceptions as bt_exceptions
2323from google .cloud .bigtable .data ._helpers import _attempt_timeout_generator
2424from google .cloud .bigtable .data ._helpers import _retry_exception_factory
3636 from google .cloud .bigtable_v2 .services .bigtable .async_client import (
3737 BigtableAsyncClient as GapicClientType ,
3838 )
39- from google .cloud .bigtable .data ._async .client import TableAsync as TableType
39+ from google .cloud .bigtable .data ._async .client import ( # type: ignore
40+ _DataApiTargetAsync as TargetType ,
41+ )
4042 else :
4143 from google .cloud .bigtable_v2 .services .bigtable .client import ( # type: ignore
4244 BigtableClient as GapicClientType ,
4345 )
44- from google .cloud .bigtable .data ._sync_autogen .client import Table as TableType # type: ignore
46+ from google .cloud .bigtable .data ._sync_autogen .client import ( # type: ignore
47+ _DataApiTarget as TargetType ,
48+ )
4549
4650__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen._mutate_rows"
4751
@@ -59,7 +63,7 @@ class _MutateRowsOperationAsync:
5963
6064 Args:
6165 gapic_client: the client to use for the mutate_rows call
62- table : the table associated with the request
66+ target : the table or view associated with the request
6367 mutation_entries: a list of RowMutationEntry objects to send to the server
6468 operation_timeout: the timeout to use for the entire operation, in seconds.
6569 attempt_timeout: the timeout to use for each mutate_rows attempt, in seconds.
@@ -70,7 +74,7 @@ class _MutateRowsOperationAsync:
7074 def __init__ (
7175 self ,
7276 gapic_client : GapicClientType ,
73- table : TableType ,
77+ target : TargetType ,
7478 mutation_entries : list ["RowMutationEntry" ],
7579 operation_timeout : float ,
7680 attempt_timeout : float | None ,
@@ -84,13 +88,8 @@ def __init__(
8488 f"{ _MUTATE_ROWS_REQUEST_MUTATION_LIMIT } mutations across "
8589 f"all entries. Found { total_mutations } ."
8690 )
87- # create partial function to pass to trigger rpc call
88- self ._gapic_fn = functools .partial (
89- gapic_client .mutate_rows ,
90- table_name = table .table_name ,
91- app_profile_id = table .app_profile_id ,
92- retry = None ,
93- )
91+ self ._target = target
92+ self ._gapic_fn = gapic_client .mutate_rows
9493 # create predicate for determining which errors are retryable
9594 self .is_retryable = retries .if_exception_type (
9695 # RPC level errors
@@ -173,8 +172,12 @@ async def _run_attempt(self):
173172 # make gapic request
174173 try :
175174 result_generator = await self ._gapic_fn (
175+ request = types_pb .MutateRowsRequest (
176+ entries = request_entries ,
177+ app_profile_id = self ._target .app_profile_id ,
178+ ** self ._target ._request_path ,
179+ ),
176180 timeout = next (self .timeout_generator ),
177- entries = request_entries ,
178181 retry = None ,
179182 )
180183 async for result_list in result_generator :
0 commit comments