Skip to content

Commit 3f0f011

Browse files
feat(bigtable): add py2 deprecation warnings; standardize use of 'required' in docstrings (via synth) (#10064)
1 parent dad70a7 commit 3f0f011

11 files changed

+321
-152
lines changed

bigtable/google/cloud/bigtable_admin_v2/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.bigtable_admin_v2 import types
2123
from google.cloud.bigtable_admin_v2.gapic import bigtable_instance_admin_client
2224
from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client
2325
from google.cloud.bigtable_admin_v2.gapic import enums
2426

2527

28+
if sys.version_info[:2] == (2, 7):
29+
message = (
30+
"A future version of this library will drop support for Python 2.7."
31+
"More details about Python 2 support for Google Cloud Client Libraries"
32+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
33+
)
34+
warnings.warn(message, DeprecationWarning)
35+
36+
2637
class BigtableInstanceAdminClient(
2738
bigtable_instance_admin_client.BigtableInstanceAdminClient
2839
):

bigtable/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ def get_iam_policy(
10511051
metadata=None,
10521052
):
10531053
"""
1054-
Gets the access control policy for an instance resource. Returns an empty
1054+
Gets the access control policy for a table resource. Returns an empty
10551055
policy if an table exists but does not have a policy set.
10561056
10571057
Example:

bigtable/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_table_admin_grpc_transport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def check_consistency(self):
267267
def get_iam_policy(self):
268268
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.get_iam_policy`.
269269
270-
Gets the access control policy for an instance resource. Returns an empty
270+
Gets the access control policy for a table resource. Returns an empty
271271
policy if an table exists but does not have a policy set.
272272
273273
Returns:

bigtable/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ service BigtableTableAdmin {
185185
};
186186
}
187187

188-
// Gets the access control policy for an instance resource. Returns an empty
188+
// Gets the access control policy for a table resource. Returns an empty
189189
// policy if an table exists but does not have a policy set.
190190
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
191191
option (google.api.http) = {

bigtable/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2_grpc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def DeleteSnapshot(self, request, context):
255255
raise NotImplementedError("Method not implemented!")
256256

257257
def GetIamPolicy(self, request, context):
258-
"""Gets the access control policy for an instance resource. Returns an empty
258+
"""Gets the access control policy for a table resource. Returns an empty
259259
policy if an table exists but does not have a policy set.
260260
"""
261261
context.set_code(grpc.StatusCode.UNIMPLEMENTED)

bigtable/google/cloud/bigtable_v2/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,22 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.bigtable_v2 import types
2123
from google.cloud.bigtable_v2.gapic import bigtable_client
2224

2325

26+
if sys.version_info[:2] == (2, 7):
27+
message = (
28+
"A future version of this library will drop support for Python 2.7."
29+
"More details about Python 2 support for Google Cloud Client Libraries"
30+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
31+
)
32+
warnings.warn(message, DeprecationWarning)
33+
34+
2435
class BigtableClient(bigtable_client.BigtableClient):
2536
__doc__ = bigtable_client.BigtableClient.__doc__
2637

bigtable/google/cloud/bigtable_v2/gapic/bigtable_client.py

+29-17
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ def read_rows(
224224
... pass
225225
226226
Args:
227-
table_name (str): The unique name of the table from which to read. Values are of the form
228-
``projects/<project>/instances/<instance>/tables/<table>``.
227+
table_name (str): Required. The unique name of the table from which to read. Values are of
228+
the form ``projects/<project>/instances/<instance>/tables/<table>``.
229229
app_profile_id (str): This value specifies routing for replication. If not specified, the
230230
"default" application profile will be used.
231231
rows (Union[dict, ~google.cloud.bigtable_v2.types.RowSet]): The row keys and/or ranges to read. If not specified, reads from all rows.
@@ -319,8 +319,9 @@ def sample_row_keys(
319319
... pass
320320
321321
Args:
322-
table_name (str): The unique name of the table from which to sample row keys. Values are
323-
of the form ``projects/<project>/instances/<instance>/tables/<table>``.
322+
table_name (str): Required. The unique name of the table from which to sample row keys.
323+
Values are of the form
324+
``projects/<project>/instances/<instance>/tables/<table>``.
324325
app_profile_id (str): This value specifies routing for replication. If not specified, the
325326
"default" application profile will be used.
326327
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -403,11 +404,14 @@ def mutate_row(
403404
>>> response = client.mutate_row(table_name, row_key, mutations)
404405
405406
Args:
406-
table_name (str): The unique name of the table to which the mutation should be applied.
407-
Values are of the form
407+
table_name (str): Required. The unique name of the table to which the mutation should be
408+
applied. Values are of the form
408409
``projects/<project>/instances/<instance>/tables/<table>``.
409-
row_key (bytes): The key of the row to which the mutation should be applied.
410-
mutations (list[Union[dict, ~google.cloud.bigtable_v2.types.Mutation]]): Changes to be atomically applied to the specified row. Entries are applied
410+
row_key (bytes): Required. The key of the row to which the mutation should be applied.
411+
412+
Classified as IDENTIFYING\_ID to provide context around data accesses
413+
for auditing systems.
414+
mutations (list[Union[dict, ~google.cloud.bigtable_v2.types.Mutation]]): Required. Changes to be atomically applied to the specified row. Entries are applied
411415
in order, meaning that earlier mutations can be masked by later ones.
412416
Must contain at least one entry and at most 100000.
413417
@@ -497,8 +501,8 @@ def mutate_rows(
497501
... pass
498502
499503
Args:
500-
table_name (str): The unique name of the table to which the mutations should be applied.
501-
entries (list[Union[dict, ~google.cloud.bigtable_v2.types.Entry]]): The row keys and corresponding mutations to be applied in bulk.
504+
table_name (str): Required. The unique name of the table to which the mutations should be applied.
505+
entries (list[Union[dict, ~google.cloud.bigtable_v2.types.Entry]]): Required. The row keys and corresponding mutations to be applied in bulk.
502506
Each entry is applied as an atomic mutation, but the entries may be
503507
applied in arbitrary order (even between entries for the same row).
504508
At least one entry must be specified, and in total the entries can
@@ -586,10 +590,14 @@ def check_and_mutate_row(
586590
>>> response = client.check_and_mutate_row(table_name, row_key)
587591
588592
Args:
589-
table_name (str): The unique name of the table to which the conditional mutation should be
590-
applied. Values are of the form
593+
table_name (str): Required. The unique name of the table to which the conditional mutation
594+
should be applied. Values are of the form
591595
``projects/<project>/instances/<instance>/tables/<table>``.
592-
row_key (bytes): The key of the row to which the conditional mutation should be applied.
596+
row_key (bytes): Required. The key of the row to which the conditional mutation should be
597+
applied.
598+
599+
Classified as IDENTIFYING\_ID to provide context around data accesses
600+
for auditing systems.
593601
app_profile_id (str): This value specifies routing for replication. If not specified, the
594602
"default" application profile will be used.
595603
predicate_filter (Union[dict, ~google.cloud.bigtable_v2.types.RowFilter]): The filter to be applied to the contents of the specified row. Depending
@@ -703,11 +711,15 @@ def read_modify_write_row(
703711
>>> response = client.read_modify_write_row(table_name, row_key, rules)
704712
705713
Args:
706-
table_name (str): The unique name of the table to which the read/modify/write rules should
707-
be applied. Values are of the form
714+
table_name (str): Required. The unique name of the table to which the read/modify/write
715+
rules should be applied. Values are of the form
708716
``projects/<project>/instances/<instance>/tables/<table>``.
709-
row_key (bytes): The key of the row to which the read/modify/write rules should be applied.
710-
rules (list[Union[dict, ~google.cloud.bigtable_v2.types.ReadModifyWriteRule]]): Rules specifying how the specified row's contents are to be transformed
717+
row_key (bytes): Required. The key of the row to which the read/modify/write rules should
718+
be applied.
719+
720+
Classified as IDENTIFYING\_ID to provide context around data accesses
721+
for auditing systems.
722+
rules (list[Union[dict, ~google.cloud.bigtable_v2.types.ReadModifyWriteRule]]): Required. Rules specifying how the specified row's contents are to be transformed
711723
into writes. Entries are applied in order, meaning that earlier rules will
712724
affect the results of later ones.
713725

0 commit comments

Comments
 (0)