def mutate_rows( self, request: bigtable.MutateRowsRequest = None, *, table_name: str = None, entries: Sequence[bigtable.MutateRowsRequest.Entry] = None, app_profile_id: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> Iterable[bigtable.MutateRowsResponse]: r"""Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically. Args: request (google.cloud.bigtable_v2.types.MutateRowsRequest): The request object. Request message for BigtableService.MutateRows. table_name (str): Required. The unique name of the table to which the mutations should be applied. This corresponds to the ``table_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. entries (Sequence[google.cloud.bigtable_v2.types.MutateRowsRequest.Entry]): Required. The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. This corresponds to the ``entries`` field on the ``request`` instance; if ``request`` is provided, this should not be set. app_profile_id (str): This value specifies routing for replication. If not specified, the "default" application profile will be used. This corresponds to the ``app_profile_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: Iterable[google.cloud.bigtable_v2.types.MutateRowsResponse]: Response message for BigtableService.MutateRows. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([table_name, entries, app_profile_id]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") # Minor optimization to avoid making a copy if the user passes # in a bigtable.MutateRowsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance(request, bigtable.MutateRowsRequest): request = bigtable.MutateRowsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if table_name is not None: request.table_name = table_name if entries is not None: request.entries = entries if app_profile_id is not None: request.app_profile_id = app_profile_id # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[self._transport.mutate_rows] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("table_name", request.table_name), )), ) # Send the request. response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Done; return the response. return response
def mutate_rows( self, request: bigtable.MutateRowsRequest = None, *, table_name: str = None, entries: Sequence[bigtable.MutateRowsRequest.Entry] = None, app_profile_id: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> Awaitable[AsyncIterable[bigtable.MutateRowsResponse]]: r"""Mutates multiple rows in a batch. Each individual row is mutated atomically as in MutateRow, but the entire batch is not executed atomically. Args: request (:class:`google.cloud.bigtable_v2.types.MutateRowsRequest`): The request object. Request message for BigtableService.MutateRows. table_name (:class:`str`): Required. The unique name of the table to which the mutations should be applied. This corresponds to the ``table_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. entries (:class:`Sequence[google.cloud.bigtable_v2.types.MutateRowsRequest.Entry]`): Required. The row keys and corresponding mutations to be applied in bulk. Each entry is applied as an atomic mutation, but the entries may be applied in arbitrary order (even between entries for the same row). At least one entry must be specified, and in total the entries can contain at most 100000 mutations. This corresponds to the ``entries`` field on the ``request`` instance; if ``request`` is provided, this should not be set. app_profile_id (:class:`str`): This value specifies routing for replication. If not specified, the "default" application profile will be used. This corresponds to the ``app_profile_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. Returns: AsyncIterable[google.cloud.bigtable_v2.types.MutateRowsResponse]: Response message for BigtableService.MutateRows. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([table_name, entries, app_profile_id]) if request is not None and has_flattened_params: raise ValueError("If the `request` argument is set, then none of " "the individual field arguments should be set.") request = bigtable.MutateRowsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if table_name is not None: request.table_name = table_name if app_profile_id is not None: request.app_profile_id = app_profile_id if entries: request.entries.extend(entries) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.mutate_rows, default_retry=retries.Retry( initial=0.01, maximum=60.0, multiplier=2, predicate=retries.if_exception_type(), deadline=600.0, ), default_timeout=600.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + (gapic_v1.routing_header.to_grpc_metadata( (("table_name", request.table_name), )), ) # Send the request. response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) # Done; return the response. return response