Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# this code path once we drop support for Python 3.7
import importlib_metadata as metadata


from .services.bigtable import BigtableAsyncClient, BigtableClient
from .types.bigtable import (
CheckAndMutateRowRequest,
Expand Down Expand Up @@ -80,6 +79,7 @@
StreamPartition,
TimestampRange,
Value,
ValueBitmask,
ValueRange,
)
from .types.feature_flags import FeatureFlags
Expand Down Expand Up @@ -161,7 +161,7 @@ def _get_version(dependency_name):
_next_supported_version = "4.25.8"
_next_supported_version_tuple = (4, 25, 8)
_recommendation = " (we recommend 6.x)"
(_version_used, _version_used_string) = _get_version(_dependency_package)
_version_used, _version_used_string = _get_version(_dependency_package)
if _version_used and _version_used < _next_supported_version_tuple:
warnings.warn(
f"Package {_package_label} depends on "
Expand Down Expand Up @@ -246,4 +246,5 @@ def _get_version(dependency_name):
"Type",
"Value",
"ValueRange",
"ValueBitmask",
)
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
Returns:
BigtableAsyncClient: The constructed client.
"""
sa_info_func = (
BigtableClient.from_service_account_info.__func__ # type: ignore
)
sa_info_func = BigtableClient.from_service_account_info.__func__ # type: ignore
return sa_info_func(BigtableAsyncClient, info, *args, **kwargs)

@classmethod
Expand All @@ -137,9 +135,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
Returns:
BigtableAsyncClient: The constructed client.
"""
sa_file_func = (
BigtableClient.from_service_account_file.__func__ # type: ignore
)
sa_file_func = BigtableClient.from_service_account_file.__func__ # type: ignore
return sa_file_func(BigtableAsyncClient, filename, *args, **kwargs)

from_service_account_json = from_service_account_file
Expand Down Expand Up @@ -281,21 +277,23 @@ def __init__(
): # pragma: NO COVER
_LOGGER.debug(
"Created client `google.bigtable_v2.BigtableAsyncClient`.",
extra={
"serviceName": "google.bigtable.v2.Bigtable",
"universeDomain": getattr(
self._client._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)(),
}
if hasattr(self._client._transport, "_credentials")
else {
"serviceName": "google.bigtable.v2.Bigtable",
"credentialsType": None,
},
extra=(
{
"serviceName": "google.bigtable.v2.Bigtable",
"universeDomain": getattr(
self._client._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)(),
}
if hasattr(self._client._transport, "_credentials")
else {
"serviceName": "google.bigtable.v2.Bigtable",
"credentialsType": None,
}
),
)

def read_rows(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,21 +774,25 @@ def __init__(
): # pragma: NO COVER
_LOGGER.debug(
"Created client `google.bigtable_v2.BigtableClient`.",
extra={
"serviceName": "google.bigtable.v2.Bigtable",
"universeDomain": getattr(
self._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)(),
}
if hasattr(self._transport, "_credentials")
else {
"serviceName": "google.bigtable.v2.Bigtable",
"credentialsType": None,
},
extra=(
{
"serviceName": "google.bigtable.v2.Bigtable",
"universeDomain": getattr(
self._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials,
"get_cred_info",
lambda: None,
)(),
}
if hasattr(self._transport, "_credentials")
else {
"serviceName": "google.bigtable.v2.Bigtable",
"credentialsType": None,
}
),
)

def read_rows(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,19 @@
StreamPartition,
TimestampRange,
Value,
ValueBitmask,
ValueRange,
)
from .feature_flags import (
FeatureFlags,
)
from .peer_info import (
PeerInfo,
)
from .feature_flags import FeatureFlags
from .peer_info import PeerInfo
from .request_stats import (
FullReadStatsView,
ReadIterationStats,
RequestLatencyStats,
RequestStats,
)
from .response_params import (
ResponseParams,
)
from .types import (
Type,
)
from .response_params import ResponseParams
from .types import Type

__all__ = (
"CheckAndMutateRowRequest",
Expand Down Expand Up @@ -133,6 +126,7 @@
"TimestampRange",
"Value",
"ValueRange",
"ValueBitmask",
"FeatureFlags",
"PeerInfo",
"FullReadStatsView",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ColumnRange",
"TimestampRange",
"ValueRange",
"ValueBitmask",
"RowFilter",
"Mutation",
"ReadModifyWriteRule",
Expand Down Expand Up @@ -558,6 +559,24 @@ class ValueRange(proto.Message):
)


class ValueBitmask(proto.Message):
r"""Restricts the output to cells whose values match the given
bitmask.

Attributes:
mask (bytes):
Required. Mask applied to the value. Evaluated as:
``(value & mask) == mask`` The mask length must exactly
match the value length, otherwise the cell is not considered
a match.
"""

mask: bytes = proto.Field(
proto.BYTES,
number=1,
)


class RowFilter(proto.Message):
r"""Takes a row as input and produces an alternate view of the row based
on specified rules. For example, a RowFilter might trim down a row
Expand Down Expand Up @@ -1012,6 +1031,12 @@ class Condition(proto.Message):
number=19,
oneof="filter",
)
value_bitmask_filter: "ValueBitmask" = proto.Field(
proto.MESSAGE,
number=20,
oneof="filter",
message="ValueBitmask",
)


class Mutation(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ async def test__on_exit(self, recwarn):
assert len(w) == 1
assert "unflushed mutations" in str(w[0].message).lower()
assert str(num_left) in str(w[0].message)
recwarn.clear()
# calling while closed is noop
instance._closed.set()
instance._on_exit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ def test__on_exit(self, recwarn):
assert len(w) == 1
assert "unflushed mutations" in str(w[0].message).lower()
assert str(num_left) in str(w[0].message)
recwarn.clear()
instance._closed.set()
instance._on_exit()
assert len(recwarn) == 0
Expand Down
Loading