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
13 changes: 9 additions & 4 deletions google/cloud/bigtable_v2/services/bigtable/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@

_LOGGER = std_logging.getLogger(__name__)

# Allow for large rows in responses.
GRPC_CLIENT_OPTIONS = [
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
]

class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
def intercept_unary_unary(self, continuation, client_call_details, request):
Expand Down Expand Up @@ -256,10 +261,6 @@ def __init__(
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

self._interceptor = _LoggingClientInterceptor()
Expand Down Expand Up @@ -307,6 +308,9 @@ def create_channel(
and ``credentials_file`` are passed.
"""

if "options" not in kwargs:
kwargs["options"] = GRPC_CLIENT_OPTIONS

return grpc_helpers.create_channel(
host,
credentials=credentials,
Expand All @@ -315,6 +319,7 @@ def create_channel(
default_scopes=cls.AUTH_SCOPES,
scopes=scopes,
default_host=cls.DEFAULT_HOST,
options=GRPC_CLIENT_OPTIONS,
**kwargs,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

from google.cloud.bigtable_v2.types import bigtable
from .base import BigtableTransport, DEFAULT_CLIENT_INFO
from .grpc import BigtableGrpcTransport
from .grpc import BigtableGrpcTransport, GRPC_CLIENT_OPTIONS

try:
from google.api_core import client_logging # type: ignore
Expand Down Expand Up @@ -163,6 +163,9 @@ def create_channel(
aio.Channel: A gRPC AsyncIO channel object.
"""

if "options" not in kwargs:
kwargs["options"] = GRPC_CLIENT_OPTIONS

return grpc_helpers_async.create_channel(
host,
credentials=credentials,
Expand Down Expand Up @@ -306,10 +309,6 @@ def __init__(
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
options=[
("grpc.max_send_message_length", -1),
("grpc.max_receive_message_length", -1),
],
)

self._interceptor = _LoggingClientAIOInterceptor()
Expand Down
Loading