Uh oh!
There was an error while loading. Please reload this page.
feat(bigtable): support materialized views in the data client - #17676
Conversation
Adds a MaterializedView class (async and sync) to the Bigtable data client, alongside Table and AuthorizedView, plus a client.get_materialized_view() factory. Materialized views are instance-scoped and read-only: read_rows and sample_row_keys route requests via materialized_view_name, while mutation methods raise NotImplementedError since the mutation RPCs cannot target a materialized view. To support targets without a backing table, table identity (table_id/table_name) moves from the shared _DataApiTarget base class into the Table and AuthorizedView subclasses.
There was a problem hiding this comment.
Code Review
This pull request introduces support for read-only Materialized Views in both synchronous and asynchronous Bigtable data clients, including the necessary client methods, documentation, and unit tests. Feedback highlights a missing @property decorator on the abstract _request_path method in _DataApiTargetAsync for consistency, and identifies a bug in the async unit tests where non-iterable return values from read_row and row_exists are incorrectly subjected to async iteration, which silently swallows errors.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…view metadata test read_row, row_exists, and the other non-streaming methods return concrete values; async-iterating them raised a TypeError that the surrounding except block silently swallowed, which could mask real errors.
mutianf
commented
Jul 10, 2026
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for read-only materialized views in the Bigtable data client by adding the MaterializedView and MaterializedViewAsync classes, along with corresponding client methods, documentation, and unit tests. To accommodate this, the base classes _DataApiTarget and _DataApiTargetAsync were refactored to decouple table-specific attributes. Feedback on the changes identifies that the abstract method _request_path in _DataApiTargetAsync is missing the @property decorator, which should be added to ensure consistency with its subclasses and its synchronous counterpart.
| @abc.abstractmethod | ||
| def _request_path(self) -> dict[str, str]: |
There was a problem hiding this comment.
In _DataApiTargetAsync, the abstract method _request_path is missing the @property decorator. All of its subclasses (TableAsync, AuthorizedViewAsync, and MaterializedViewAsync) implement _request_path as a property, and the sync counterpart _DataApiTarget also defines it as a property. Adding @property here ensures consistency, prevents potential static analysis/type checking warnings, and matches the subclass implementations.
@property@abc.abstractmethoddef_request_path(self) ->dict[str, str]:
mutianf
left a comment
There was a problem hiding this comment.
Lgtm but we should add a systest (in a follow up PR).
…d-view-data-api-target
Uh oh!
There was an error while loading. Please reload this page.
🤖 I have created a release *beep* *boop* --- <details><summary>google-api-core: 2.32.0</summary> ## [2.32.0](google-api-core-v2.31.0...google-api-core-v2.32.0) (2026-07-16) ### Features * implement PEP 0810 lazy loading in operations_v1 ([#17724](#17724)) ([22c5304](22c5304)) ### Bug Fixes * **api_core:** clarify misleading http 404 unimplemented error message ([#17681](#17681)) ([00b9040](00b9040)) </details> <details><summary>google-apps-chat: 0.10.3</summary> ## [0.10.3](google-apps-chat-v0.10.2...google-apps-chat-v0.10.3) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-batch: 0.22.1</summary> ## [0.22.1](google-cloud-batch-v0.22.0...google-cloud-batch-v0.22.1) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-bigtable: 2.41.0</summary> ## [2.41.0](google-cloud-bigtable-v2.40.0...google-cloud-bigtable-v2.41.0) (2026-07-16) ### Features * **bigtable:** support materialized views in the data client ([#17676](#17676)) ([2c3c213](2c3c213)) </details> <details><summary>google-cloud-compute: 1.50.0</summary> ## [1.50.0](google-cloud-compute-v1.49.0...google-cloud-compute-v1.50.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-compute-v1beta: 0.12.1</summary> ## [0.12.1](google-cloud-compute-v1beta-v0.12.0...google-cloud-compute-v1beta-v0.12.1) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-dialogflow: 2.51.0</summary> ## [2.51.0](google-cloud-dialogflow-v2.50.0...google-cloud-dialogflow-v2.51.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-discoveryengine: 0.20.2</summary> ## [0.20.2](google-cloud-discoveryengine-v0.20.1...google-cloud-discoveryengine-v0.20.2) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-kms: 3.16.0</summary> ## [3.16.0](google-cloud-kms-v3.15.0...google-cloud-kms-v3.16.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-memorystore: 0.5.3</summary> ## [0.5.3](google-cloud-memorystore-v0.5.2...google-cloud-memorystore-v0.5.3) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-secret-manager: 2.30.0</summary> ## [2.30.0](google-cloud-secret-manager-v2.29.0...google-cloud-secret-manager-v2.30.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-cloud-securitycenter: 1.46.0</summary> ## [1.46.0](google-cloud-securitycenter-v1.45.0...google-cloud-securitycenter-v1.46.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-shopping-merchant-inventories: 1.6.0</summary> ## [1.6.0](google-shopping-merchant-inventories-v1.5.0...google-shopping-merchant-inventories-v1.6.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> <details><summary>google-shopping-merchant-products: 1.8.0</summary> ## [1.8.0](google-shopping-merchant-products-v1.7.0...google-shopping-merchant-products-v1.8.0) (2026-07-16) ### Features * update googleapis and regenerate ([#17725](#17725)) ([35e16da](35e16da)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Summary
Adds materialized view support to the Bigtable data client, alongside the existing
TableandAuthorizedViewsurfaces:MaterializedView/MaterializedViewAsyncclasses (subclasses of_DataApiTarget) and aclient.get_materialized_view(instance_id, materialized_view_id)factory. Reads (read_rows*,sample_row_keys,row_exists) route requests via thematerialized_view_namefield.materialized_view_namefield — somutate_row,bulk_mutate_rows,check_and_mutate_row,read_modify_write_row, andmutations_batcherare overridden to raiseNotImplementedErrorimmediately instead of failing with an opaque proto error (or, for the batcher, failing later in a background flush).table_id/table_name) moves from the shared_DataApiTargetbase class into theTableandAuthorizedViewsubclasses. Public constructor signatures are unchanged.nox -s generate_sync; docs pages added for both new classes.Test plan
TestMaterializedViewsuites (async + generated sync) cover construction, routing metadata (name=<instance path>header), factory passthrough, context-manager use, and the mutation-method rejection;get_materialized_viewadded to the existing API-surface parametrizationstests/unitsuite passes locally (5394 passed)ReadRows/SampleRowKeysrequests carrymaterialized_view_name(nottable_name), rows are returned through the public API, andTable/AuthorizedViewbehavior is unchanged