googleapis / googleapis/google-cloud-python

Use shim for legacy client mutate_rows

Ouverte
#15,292 1 commentaire 0 réactions 1 personne assignée Réclamée par @gkevinzheng Voir sur GitHub
api: bigtable priority: p3 type: feature request
Langage dominant
Python
Étoiles
5.4k
Forks
1.8k
Merge moyen
3 j 4 h
PR mergées (30 j)
122

Description

From go/bigtable_legacy_deprecation:
> Old API
> - The [Table](https://github.com/googleapis/python-bigtable/blob/4492f9fe2760d423944672264c2c1770488a9c8c/google/cloud/bigtable/table.py#L103) class exposes a [mutate_rows method](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L690)
> - The method takes in a list of [DirectRow](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/row.py#L252) instances
> - The method builds a [_RetryableMutateRowsWorker](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L1067), and then [calls it](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L739) with a retry object
> - The majority of the mutate_rows logic happens in [_RetryableMutateRowsWorker._do_retryable_rows](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L1113), which is [wrapped in](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L1096) [api_core.Retry logic](https://github.com/googleapis/python-api-core/blob/a5648faf31c30158d59a3127ea37f7c9911ff765/google/api_core/retry/retry_unary.py#L169)
> - [Retryable errors](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L62) are handled by the retry wrapper (which can also contain [its own user-provided retryable errors](https://github.com/googleapis/python-api-core/blob/a5648faf31c30158d59a3127ea37f7c9911ff765/google/api_core/retry/retry_base.py#L237))
> - Any failed mutations with retryable errors will be tried again, until the deadline is hit
> - Table.mutate_rows returns a list of Status protos, one for each mutation attempted
> - If the rpc hits a non-retryable error, the exception is raised immediately
> - If the rpc times-out without any responses, it returns a list of `None`s
>
> Replacement
> - We can replace [_RetryableMutateRowsWorker](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/table.py#L1067) with a new implementation that defers all work to the data client’s internal [_MutateRowsOperation class](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py#L38)
> - [DirectRows](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/row.py#L252) will have to be converted to corresponding [RowMutationEntries](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/data/mutations.py#L279)
> - We catch any [MutateExceptionGroup](https://github.com/googleapis/python-bigtable/blob/7cab3e88b7c7e880d7ecaa574f70a88fe35c700f/google/cloud/bigtable/data/exceptions.py#L144) exceptions, and build a status dict to return instead
> - If no exceptions are raised, return a list of Status.OK results

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.