Skip to content

Commit 2031110

Browse files
committed
fixed SDK incompatibility with old grpcio versions
1 parent 29316f0 commit 2031110

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.8.0 ##
2+
3+
* fixed the SDK incompatibility with old grpcio versions.
4+
15
## 2.7.0 ##
26

37
* fixes in TxContext in ydb.aio module.

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setuptools.setup(
88
name="ydb",
9-
version="2.8.0",
9+
version="2.9.0",
1010
description="YDB Python SDK",
1111
author="Yandex LLC",
1212
author_email="ydb@yandex-team.ru",

ydb/connection.py

+20-19
Original file line numberDiff line numberDiff line change
@@ -304,23 +304,21 @@ def channel_factory(
304304
options = _construct_channel_options(driver_config, endpoint_options)
305305
logger.debug("Channel options: {}".format(options))
306306

307+
kwargs = {}
308+
compression = getattr(driver_config, "compression", None)
309+
if compression is not None:
310+
kwargs = {"compression": compression}
311+
307312
if driver_config.root_certificates is None and not driver_config.secure_channel:
308-
return channel_provider.insecure_channel(
309-
endpoint, options, compression=getattr(driver_config, "compression", None)
310-
)
313+
return channel_provider.insecure_channel(endpoint, options, **kwargs)
311314

312315
root_certificates = driver_config.root_certificates
313316
if root_certificates is None:
314317
root_certificates = default_pem.load_default_pem()
315318
credentials = grpc.ssl_channel_credentials(
316319
root_certificates, driver_config.private_key, driver_config.certificate_chain
317320
)
318-
return channel_provider.secure_channel(
319-
endpoint,
320-
credentials,
321-
options,
322-
compression=getattr(driver_config, "compression", None),
323-
)
321+
return channel_provider.secure_channel(endpoint, credentials, options, **kwargs)
324322

325323

326324
class EndpointKey(object):
@@ -434,11 +432,14 @@ def future(
434432
rpc_state, timeout, metadata = self._prepare_call(
435433
stub, rpc_name, request, settings
436434
)
435+
436+
kwargs = {}
437+
compression = getattr(settings, "compression", None)
438+
if compression is not None:
439+
kwargs = {"compression": compression}
440+
437441
rendezvous, result_future = rpc_state.future(
438-
request,
439-
timeout,
440-
metadata,
441-
compression=getattr(settings, "compression", None),
442+
request, timeout, metadata, **kwargs
442443
)
443444
rendezvous.add_done_callback(
444445
lambda resp_future: _on_response_callback(
@@ -477,12 +478,12 @@ def __call__(
477478
stub, rpc_name, request, settings
478479
)
479480
try:
480-
response = rpc_state(
481-
request,
482-
timeout,
483-
metadata,
484-
compression=getattr(settings, "compression", None),
485-
)
481+
kwargs = {}
482+
compression = getattr(settings, "compression", None)
483+
if compression is not None:
484+
kwargs = {"compression": compression}
485+
486+
response = rpc_state(request, timeout, metadata, **kwargs)
486487
_log_response(rpc_state, response)
487488
return (
488489
response

ydb/ydb_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "2.8.0"
1+
VERSION = "2.9.0"

0 commit comments

Comments
 (0)