7474 from google .cloud .bigtable .data import ShardedQuery
7575
7676# used by read_rows_sharded to limit how many requests are attempted in parallel
77- CONCURRENCY_LIMIT = 10
77+ _CONCURRENCY_LIMIT = 10
7878
7979# used to register instance data with the client for channel warming
8080_WarmedInstanceKey = namedtuple (
@@ -154,7 +154,7 @@ def __init__(
154154 self ._channel_init_time = time .monotonic ()
155155 self ._channel_refresh_tasks : list [asyncio .Task [None ]] = []
156156 try :
157- self .start_background_channel_refresh ()
157+ self ._start_background_channel_refresh ()
158158 except RuntimeError :
159159 warnings .warn (
160160 f"{ self .__class__ .__name__ } should be started in an "
@@ -163,7 +163,7 @@ def __init__(
163163 stacklevel = 2 ,
164164 )
165165
166- def start_background_channel_refresh (self ) -> None :
166+ def _start_background_channel_refresh (self ) -> None :
167167 """
168168 Starts a background task to ping and warm each channel in the pool
169169 Raises:
@@ -309,7 +309,7 @@ async def _register_instance(self, instance_id: str, owner: TableAsync) -> None:
309309 await self ._ping_and_warm_instances (channel , instance_key )
310310 else :
311311 # refresh tasks aren't active. start them as background tasks
312- self .start_background_channel_refresh ()
312+ self ._start_background_channel_refresh ()
313313
314314 async def _remove_instance_registration (
315315 self , instance_id : str , owner : TableAsync
@@ -388,7 +388,7 @@ def get_table(
388388 )
389389
390390 async def __aenter__ (self ):
391- self .start_background_channel_refresh ()
391+ self ._start_background_channel_refresh ()
392392 return self
393393
394394 async def __aexit__ (self , exc_type , exc_val , exc_tb ):
@@ -493,7 +493,7 @@ def __init__(
493493
494494 async def read_rows_stream (
495495 self ,
496- query : ReadRowsQuery | dict [ str , Any ] ,
496+ query : ReadRowsQuery ,
497497 * ,
498498 operation_timeout : float | None = None ,
499499 attempt_timeout : float | None = None ,
@@ -557,7 +557,7 @@ async def read_rows_stream(
557557
558558 async def read_rows (
559559 self ,
560- query : ReadRowsQuery | dict [ str , Any ] ,
560+ query : ReadRowsQuery ,
561561 * ,
562562 operation_timeout : float | None = None ,
563563 attempt_timeout : float | None = None ,
@@ -687,10 +687,10 @@ async def read_rows_sharded(
687687 timeout_generator = _attempt_timeout_generator (
688688 operation_timeout , operation_timeout
689689 )
690- # submit shards in batches if the number of shards goes over CONCURRENCY_LIMIT
690+ # submit shards in batches if the number of shards goes over _CONCURRENCY_LIMIT
691691 batched_queries = [
692- sharded_query [i : i + CONCURRENCY_LIMIT ]
693- for i in range (0 , len (sharded_query ), CONCURRENCY_LIMIT )
692+ sharded_query [i : i + _CONCURRENCY_LIMIT ]
693+ for i in range (0 , len (sharded_query ), _CONCURRENCY_LIMIT )
694694 ]
695695 # run batches and collect results
696696 results_list = []
@@ -1038,7 +1038,7 @@ async def bulk_mutate_rows(
10381038 async def check_and_mutate_row (
10391039 self ,
10401040 row_key : str | bytes ,
1041- predicate : RowFilter | dict [ str , Any ] | None ,
1041+ predicate : RowFilter | None ,
10421042 * ,
10431043 true_case_mutations : Mutation | list [Mutation ] | None = None ,
10441044 false_case_mutations : Mutation | list [Mutation ] | None = None ,
@@ -1091,12 +1091,12 @@ async def check_and_mutate_row(
10911091 ):
10921092 false_case_mutations = [false_case_mutations ]
10931093 false_case_dict = [m ._to_dict () for m in false_case_mutations or []]
1094- if predicate is not None and not isinstance (predicate , dict ):
1095- predicate = predicate .to_dict ()
10961094 metadata = _make_metadata (self .table_name , self .app_profile_id )
10971095 result = await self .client ._gapic_client .check_and_mutate_row (
10981096 request = {
1099- "predicate_filter" : predicate ,
1097+ "predicate_filter" : predicate ._to_dict ()
1098+ if predicate is not None
1099+ else None ,
11001100 "true_mutations" : true_case_dict ,
11011101 "false_mutations" : false_case_dict ,
11021102 "table_name" : self .table_name ,
0 commit comments