8000 feat: add ChangeStreamConfig to CreateTable and UpdateTable (#786) · googleapis/python-bigtable@cef70f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit cef70f2

Browse files
feat: add ChangeStreamConfig to CreateTable and UpdateTable (#786)
* feat: add ChangeStreamConfig to CreateTable and UpdateTable PiperOrigin-RevId: 534836567 Source-Link: googleapis/googleapis@eb2d1f1 Source-Link: googleapis/googleapis-gen@64cebcf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjRjZWJjZmMyNzY1YmZmNWFmYjE5YzE0MGQ0YjE2MDBkZmRhZWJhZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 9e35ad2 commit cef70f2

File tree

8 files changed

+67
-18
lines changed

8 files changed

+67
-18
lines changed

google/cloud/bigtable_admin/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
from google.cloud.bigtable_admin_v2.types.instance import Instance
201201
from google.cloud.bigtable_admin_v2.types.table import Backup
202202
from google.cloud.bigtable_admin_v2.types.table import BackupInfo
203+
from google.cloud.bigtable_admin_v2.types.table import ChangeStreamConfig
203204
from google.cloud.bigtable_admin_v2.types.table import ColumnFamily
204205
from google.cloud.bigtable_admin_v2.types.table import EncryptionInfo
205206
from google.cloud.bigtable_admin_v2.types.table import GcRule
@@ -282,6 +283,7 @@
282283
"Instance",
283284
"Backup",
284285
"BackupInfo",
286+
"ChangeStreamConfig",
285287
"ColumnFamily",
286288
"EncryptionInfo",
287289
"GcRule",

google/cloud/bigtable_admin_v2/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
from .types.instance import Instance
9393
from .types.table import Backup
9494
from .types.table import BackupInfo
95+
from .types.table import ChangeStreamConfig
9596
from .types.table import ColumnFamily
9697
from .types.table import EncryptionInfo
9798
from .types.table import GcRule
@@ -110,6 +111,7 @@
110111
"BackupInfo",
111112
"BigtableInstanceAdminClient",
112113
"BigtableTableAdminClient",
114+
"ChangeStreamConfig",
113115
"CheckConsistencyRequest",
114116
"CheckConsistencyResponse",
115117
"Cluster",

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,16 +683,19 @@ async def update_table(
683683
should not be set.
684684
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
685685
Required. The list of fields to update. A mask
686-
specifying which fields (e.g. ``deletion_protection``)
686+
specifying which fields (e.g. ``change_stream_config``)
687687
in the ``table`` field should be updated. This mask is
688688
relative to the ``table`` field, not to the request
689689
message. The wildcard (*) path is currently not
690690
supported. Currently UpdateTable is only supported for
691-
the following field:
691+
the following fields:
692692
693-
- ``deletion_protection`` If ``column_families`` is set
694-
in ``update_mask``, it will return an UNIMPLEMENTED
695-
error.
693+
- ``change_stream_config``
694+
- ``change_stream_config.retention_period``
695+
- ``deletion_protection``
696+
697+
If ``column_families`` is set in ``update_mask``, it
698+
will return an UNIMPLEMENTED error.
696699
697700
This corresponds to the ``update_mask`` field
698701
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,16 +992,19 @@ def update_table(
992992
should not be set.
993993
update_mask (google.protobuf.field_mask_pb2.FieldMask):
994994
Required. The list of fields to update. A mask
995-
specifying which fields (e.g. ``deletion_protection``)
995+
specifying which fields (e.g. ``change_stream_config``)
996996
in the ``table`` field should be updated. This mask is
997997
relative to the ``table`` field, not to the request
998998
message. The wildcard (*) path is currently not
999999
supported. Currently UpdateTable is only supported for
1000-
the following field:
1000+
the following fields:
10011001
1002-
- ``deletion_protection`` If ``column_families`` is set
1003-
in ``update_mask``, it will return an UNIMPLEMENTED
1004-
error.
1002+
- ``change_stream_config``
1003+
- ``change_stream_config.retention_period``
1004+
- ``deletion_protection``
1005+
1006+
If ``column_families`` is set in ``update_mask``, it
1007+
will return an UNIMPLEMENTED error.
10051008
10061009
This corresponds to the ``update_mask`` field
10071010
on the ``request`` instance; if ``request`` is provided, this

google/cloud/bigtable_admin_v2/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
from .table import (
9292
Backup,
9393
BackupInfo,
94+
ChangeStreamConfig,
9495
ColumnFamily,
9596
EncryptionInfo,
9697
GcRule,
@@ -170,6 +171,7 @@
170171
"Instance",
171172
"Backup",
172173
"BackupInfo",
174+
"ChangeStreamConfig",
173175
"ColumnFamily",
174176
"EncryptionInfo",
175177
"GcRule",

google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,18 @@ class UpdateTableRequest(proto.Message):
460460
used to identify the table to update.
461461
update_mask (google.protobuf.field_mask_pb2.FieldMask):
462462
Required. The list of fields to update. A mask specifying
463-
which fields (e.g. ``deletion_protection``) in the ``table``
464-
field should be updated. This mask is relative to the
465-
``table`` field, not to the request message. The wildcard
466-
(*) path is currently not supported. Currently UpdateTable
467-
is only supported for the following field:
468-
469-
- ``deletion_protection`` If ``column_families`` is set in
470-
``update_mask``, it will return an UNIMPLEMENTED error.
463+
which fields (e.g. ``change_stream_config``) in the
464+
``table`` field should be updated. This mask is relative to
465+
the ``table`` field, not to the request message. The
466+
wildcard (*) path is currently not supported. Currently
467+
UpdateTable is only supported for the following fields:
468+
469+
- ``change_stream_config``
470+
- ``change_stream_config.retention_period``
471+
- ``deletion_protection``
472+
473+
If ``column_families`` is set in ``update_mask``, it will
474+
return an UNIMPLEMENTED error.
471475
"""
472476

473477
table: gba_table.Table = proto.Field(

google/cloud/bigtable_admin_v2/types/table.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
manifest={
3030
"RestoreSourceType",
3131
"RestoreInfo",
32+
"ChangeStreamConfig",
3233
"Table",
3334
"ColumnFamily",
3435
"GcRule",
@@ -82,6 +83,27 @@ class RestoreInfo(proto.Message):
8283
)
8384

8485

86+
class ChangeStreamConfig(proto.Message):
87+
r"""Change stream configuration.
88+
89+
Attributes:
90+
retention_period (google.protobuf.duration_pb2.Duration):
91+
How long the change stream should be
92+
retained. Change stream data older than the
93+
retention period will not be returned when
94+
reading the change stream from the table.
95+
Values must be at least 1 day and at most 7
96+
days, and will be truncated to microsecond
97+
granularity.
98+
"""
99+
100+
retention_period: duration_pb2.Duration = proto.Field(
101+
proto.MESSAGE,
102+
number=1,
103+
message=duration_pb2.Duration,
104+
)
105+
106+
85107
class Table(proto.Message):
86108
r"""A collection of user data indexed by row, column, and
87109
timestamp. Each table is served using the resources of its
@@ -114,6 +136,10 @@ class Table(proto.Message):
114136
another data source (e.g. a backup), this field
115137
will be populated with information about the
116138
restore.
139+
change_stream_config (google.cloud.bigtable_admin_v2.types.ChangeStreamConfig):
140+
If specified, enable the change stream on
141+
this table. Otherwise, the change stream is
142+
disabled and the change stream is not retained.
117143
deletion_protection (bool):
118144
Set to true to make the table protected
119145
against data loss. i.e. deleting the following
@@ -263,6 +289,11 @@ class ReplicationState(proto.Enum):
263289
number=6,
264290
message="RestoreInfo",
265291
)
292+
change_stream_config: "ChangeStreamConfig" = proto.Field(
293+
proto.MESSAGE,
294+
number=8,
295+
message="ChangeStreamConfig",
296+
)
266297
deletion_protection: bool = proto.Field(
267298
proto.BOOL,
268299
number=9,

tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8202,6 +8202,7 @@ def test_update_table_rest(request_type):
82028202
"source_table": "source_table_value",
82038203
},
82048204
},
8205+
"change_stream_config": {"retention_period": {"seconds": 751, "nanos": 543}},
82058206
"deletion_protection": True,
82068207
}
82078208
request = request_type(**request_init)
@@ -8399,6 +8400,7 @@ def test_update_table_rest_bad_request(
83998400
"source_table": "source_table_value",
84008401
},
84018402
},
8403+
"change_stream_config": {"retention_period": {"seconds": 751, "nanos": 543}},
84028404
"deletion_protection": True,
84038405
}
84048406
request = request_type(**request_init)

0 commit comments

Comments
 (0)
0