Skip to content

Commit 6c9a1ba

Browse files
authored
fix: pass gRPC config options to gRPC channel creation (#26)
* fix: pass gRPC config options to grpc channel creation * regen spanner_grpc_transport.py to include changes (via synth) Co-authored-by: larkee <[email protected]>
1 parent 0f526bf commit 6c9a1ba

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

google/cloud/spanner_v1/gapic/transports/spanner_grpc_transport.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def create_channel(
107107
pkg_resources.resource_string(__name__, _SPANNER_GRPC_CONFIG)
108108
)
109109
options = [(grpc_gcp.API_CONFIG_CHANNEL_ARG, grpc_gcp_config)]
110+
if "options" in kwargs:
111+
options.extend(kwargs["options"])
112+
kwargs["options"] = options
110113
return google.api_core.grpc_helpers.create_channel(
111114
address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
112115
)

synth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
"\g<1>grpc_gcp_config = grpc_gcp.api_config_from_text_pb("
6363
"\g<1> pkg_resources.resource_string(__name__, _SPANNER_GRPC_CONFIG))"
6464
"\g<1>options = [(grpc_gcp.API_CONFIG_CHANNEL_ARG, grpc_gcp_config)]"
65+
"\g<1>if 'options' in kwargs:"
66+
"\g<1> options.extend(kwargs['options'])"
67+
"\g<1>kwargs['options'] = options"
6568
"\g<0>",
6669
)
6770
s.replace(

0 commit comments

Comments
 (0)