diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index 639311e6f..fa8a1874f 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -951,12 +951,11 @@ async def mutate_row( ) _validate_timeouts(operation_timeout, attempt_timeout) - if mutations and not isinstance(mutations, list): - mutations = [mutations] - if not mutations: + mutations_list = mutations if isinstance(mutations, list) else [mutations] + if not mutations_list: raise ValueError("No mutations provided") - if all(mutation.is_idempotent() for mutation in mutations): + if all(mutation.is_idempotent() for mutation in mutations_list): # mutations are all idempotent and safe to retry predicate = retries.if_exception_type( core_exceptions.DeadlineExceeded, @@ -990,7 +989,7 @@ def on_error_fn(exc): # trigger rpc await deadline_wrapped( row_key=row_key.encode("utf-8") if isinstance(row_key, str) else row_key, - mutations=[mutation._to_pb() for mutation in mutations], + mutations=[mutation._to_pb() for mutation in mutations_list], table_name=self.table_name, app_profile_id=self.app_profile_id, timeout=attempt_timeout, diff --git a/google/cloud/bigtable/data/read_modify_write_rules.py b/google/cloud/bigtable/data/read_modify_write_rules.py index dd1399510..f43dbe79f 100644 --- a/google/cloud/bigtable/data/read_modify_write_rules.py +++ b/google/cloud/bigtable/data/read_modify_write_rules.py @@ -69,7 +69,7 @@ def __init__(self, family: str, qualifier: bytes | str, append_value: bytes | st super().__init__(family, qualifier) self.append_value = append_value - def _to_dict(self) -> dict[str, str | bytes]: + def _to_dict(self) -> dict[str, str | bytes | int]: return { "family_name": self.family, "column_qualifier": self.qualifier,