googleapis / googleapis/google-cloud-python

Use shim for legacy client mutate_rows

未关闭
#15,292 1 条评论 0 个 reaction 已指派 1 人 已被 @gkevinzheng 认领 在 GitHub 查看
api: bigtable priority: p3 type: feature request
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
2 天 23 小时
30 天内合并 PR
123

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。