diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/types/table.py b/packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/types/table.py index d74e3ec9be71..0340e68a8c5c 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/types/table.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable_admin_v2/types/table.py @@ -246,10 +246,14 @@ class TimestampGranularity(proto.Enum): MILLIS (1): The table keeps data versioned at a granularity of 1ms. + MICROS (2): + The table keeps data versioned at a + granularity of 1us. """ TIMESTAMP_GRANULARITY_UNSPECIFIED = 0 MILLIS = 1 + MICROS = 2 class View(proto.Enum): r"""Defines a view over a table's fields. diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py index 1518a0364594..a404a0d034d3 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py @@ -1082,8 +1082,36 @@ class Mutation(proto.Message): Deletes cells from the entire row. This field is a member of `oneof`_ ``mutation``. + timestamp_origin (google.cloud.bigtable_v2.types.Mutation.TimestampOrigin): + Optional. The origin of the timestamp in this + mutation. """ + class TimestampOrigin(proto.Enum): + r"""Represents the origin of the timestamp in the mutation. + + Values: + TIMESTAMP_ORIGIN_UNSPECIFIED (0): + Default value. Should not be explicitly set. + USER_SPECIFIED (1): + Indicates that the timestamp was explicitly provided by the + user (either ``>0`` or ``-1`` for server-assigned). The + server will reject the mutation if the timestamp's precision + does not match the table's granularity. (e.g., a millisecond + table only allows timestamps that are multiples of 1000). + CLIENT_AUTO_GENERATED (2): + Indicates that the timestamp was + auto-generated by the client library. The server + will truncate the timestamp's precision to match + the table's granularity. + (e.g., zeroing the last 3 digits for a + millisecond table). + """ + + TIMESTAMP_ORIGIN_UNSPECIFIED = 0 + USER_SPECIFIED = 1 + CLIENT_AUTO_GENERATED = 2 + class SetCell(proto.Message): r"""A Mutation which sets the value of the specified cell. @@ -1295,6 +1323,11 @@ class DeleteFromRow(proto.Message): oneof="mutation", message=DeleteFromRow, ) + timestamp_origin: TimestampOrigin = proto.Field( + proto.ENUM, + number=7, + enum=TimestampOrigin, + ) class ReadModifyWriteRule(proto.Message): diff --git a/packages/google-cloud-storage/tests/resumable_media/unit/requests/test_upload.py b/packages/google-cloud-storage/tests/resumable_media/unit/requests/test_upload.py index fcdbe38c1b4c..d7c2d53ecccb 100644 --- a/packages/google-cloud-storage/tests/resumable_media/unit/requests/test_upload.py +++ b/packages/google-cloud-storage/tests/resumable_media/unit/requests/test_upload.py @@ -18,9 +18,10 @@ import tempfile from unittest import mock -import google.cloud.storage._media.requests.upload as upload_mod import pytest # type: ignore +import google.cloud.storage._media.requests.upload as upload_mod + URL_PREFIX = "https://www.googleapis.com/upload/storage/v1/b/{BUCKET}/o" SIMPLE_URL = URL_PREFIX + "?uploadType=media&name={OBJECT}" MULTIPART_URL = URL_PREFIX + "?uploadType=multipart" diff --git a/packages/google-cloud-storage/tests/system/test_blob.py b/packages/google-cloud-storage/tests/system/test_blob.py index 76b93d2789b0..e3b558f5b606 100644 --- a/packages/google-cloud-storage/tests/system/test_blob.py +++ b/packages/google-cloud-storage/tests/system/test_blob.py @@ -23,6 +23,7 @@ import mock import pytest from google.api_core import exceptions + from google.cloud.storage._helpers import _base64_md5hash from google.cloud.storage.exceptions import DataCorruption