Skip to content

Commit d522528

Browse files
committed
feat(bigtable): support materialized views in the data client
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.
1 parent dcbe750 commit d522528

8 files changed

Lines changed: 938 additions & 67 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Materialized View Async
2+
~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
.. note::
5+
6+
It is generally not recommended to use the async client in an otherwise synchronous codebase. To make use of asyncio's
7+
performance benefits, the codebase should be designed to be async from the ground up.
8+
9+
.. autoclass:: google.cloud.bigtable.data._async.client.MaterializedViewAsync
10+
:members:
11+
:inherited-members:

packages/google-cloud-bigtable/docs/data_client/data_client_usage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Sync Surface
1010
sync_data_client
1111
sync_data_table
1212
sync_data_authorized_view
13+
sync_data_materialized_view
1314
sync_data_mutations_batcher
1415
sync_data_execute_query_iterator
1516

@@ -22,6 +23,7 @@ Async Surface
2223
async_data_client
2324
async_data_table
2425
async_data_authorized_view
26+
async_data_materialized_view
2527
async_data_mutations_batcher
2628
async_data_execute_query_iterator
2729

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Materialized View
2+
~~~~~~~~~~~~~~~~~
3+
4+
.. autoclass:: google.cloud.bigtable.data._sync_autogen.client.MaterializedView
5+
:members:
6+
:inherited-members:

packages/google-cloud-bigtable/google/cloud/bigtable/data/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from google.cloud.bigtable.data._async.client import (
2020
AuthorizedViewAsync,
2121
BigtableDataClientAsync,
22+
MaterializedViewAsync,
2223
TableAsync,
2324
)
2425
from google.cloud.bigtable.data._async.mutations_batcher import MutationsBatcherAsync
@@ -33,6 +34,7 @@
3334
from google.cloud.bigtable.data._sync_autogen.client import (
3435
AuthorizedView,
3536
BigtableDataClient,
37+
MaterializedView,
3638
Table,
3739
)
3840
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import MutationsBatcher
@@ -80,10 +82,12 @@
8082
"BigtableDataClientAsync",
8183
"TableAsync",
8284
"AuthorizedViewAsync",
85+
"MaterializedViewAsync",
8386
"MutationsBatcherAsync",
8487
"BigtableDataClient",
8588
"Table",
8689
"AuthorizedView",
90+
"MaterializedView",
8791
"MutationsBatcher",
8892
"RowKeySamples",
8993
"ReadRowsQuery",

0 commit comments

Comments
 (0)