Commit 2c3c213
feat(bigtable): support materialized views in the data client (#17676)
## Summary
Adds materialized view support to the Bigtable data client, alongside
the existing `Table` and `AuthorizedView` surfaces:
- New `MaterializedView` / `MaterializedViewAsync` classes (subclasses
of `_DataApiTarget`) and a `client.get_materialized_view(instance_id,
materialized_view_id)` factory. Reads (`read_rows*`, `sample_row_keys`,
`row_exists`) route requests via the `materialized_view_name` field.
- Materialized views are read-only in the Bigtable API — the mutation
RPCs have no `materialized_view_name` field — so `mutate_row`,
`bulk_mutate_rows`, `check_and_mutate_row`, `read_modify_write_row`, and
`mutations_batcher` are overridden to raise `NotImplementedError`
immediately instead of failing with an opaque proto error (or, for the
batcher, failing later in a background flush).
- Since materialized views are instance-scoped and have no backing
table, table identity (`table_id`/`table_name`) moves from the shared
`_DataApiTarget` base class into the `Table` and `AuthorizedView`
subclasses. Public constructor signatures are unchanged.
- Sync surfaces regenerated via `nox -s generate_sync`; docs pages added
for both new classes.
## Test plan
- [x] Unit tests: new `TestMaterializedView` suites (async + generated
sync) cover construction, routing metadata (`name=<instance path>`
header), factory passthrough, context-manager use, and the
mutation-method rejection; `get_materialized_view` added to the existing
API-surface parametrizations
- [x] Full `tests/unit` suite passes locally (5394 passed)
- [x] Manually exercised against a local gRPC server:
`ReadRows`/`SampleRowKeys` requests carry `materialized_view_name` (not
`table_name`), rows are returned through the public API, and
`Table`/`AuthorizedView` behavior is unchanged
- [ ] CI (docs build, lint, sync-up-to-date check across supported
Python versions)
---------
Co-authored-by: Anthonios Partheniou <partheniou@google.com>1 parent 1ef0340 commit 2c3c213
8 files changed
Lines changed: 941 additions & 60 deletions
File tree
- packages/google-cloud-bigtable
- docs/data_client
- google/cloud/bigtable/data
- _async
- _sync_autogen
- tests/unit/data
- _async
- _sync_autogen
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
0 commit comments