aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-07-23 07:47:34 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-07-23 07:56:54 +0300
commite9497f65d8bbe478a583fa31b74e03a8d342ff5f (patch)
tree48793f79ab80ae9a82e77744ed89f82aeee8e59a /contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py
parent973312112362cf03ce0f7d4e5fdbcb63d1166670 (diff)
downloadydb-e9497f65d8bbe478a583fa31b74e03a8d342ff5f.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py')
-rw-r--r--contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py
index 03b5bbe324..bf3c0d863f 100644
--- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py
+++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/httpclient.py
@@ -69,7 +69,8 @@ class HttpClient(Client):
https_proxy: Optional[str] = None,
server_host_name: Optional[str] = None,
apply_server_timezone: Optional[Union[str, bool]] = None,
- show_clickhouse_errors: Optional[bool] = None):
+ show_clickhouse_errors: Optional[bool] = None,
+ autogenerate_session_id: Optional[bool] = None):
"""
Create an HTTP ClickHouse Connect client
See clickhouse_connect.get_client for parameters
@@ -93,7 +94,7 @@ class HttpClient(Client):
# pylint: disable=too-many-boolean-expressions
if not self.http and (server_host_name or ca_cert or client_cert or not verify or https_proxy):
options = {'verify': verify is not False}
- dict_add(options,'ca_cert', ca_cert)
+ dict_add(options, 'ca_cert', ca_cert)
dict_add(options, 'client_cert', client_cert)
dict_add(options, 'client_cert_key', client_cert_key)
if server_host_name:
@@ -128,9 +129,14 @@ class HttpClient(Client):
self._progress_interval = None
self._active_session = None
+ # allow to override the global autogenerate_session_id setting via the constructor params
+ _autogenerate_session_id = common.get_setting('autogenerate_session_id') \
+ if autogenerate_session_id is None \
+ else autogenerate_session_id
+
if session_id:
ch_settings['session_id'] = session_id
- elif 'session_id' not in ch_settings and common.get_setting('autogenerate_session_id'):
+ elif 'session_id' not in ch_settings and _autogenerate_session_id:
ch_settings['session_id'] = str(uuid.uuid4())
if coerce_bool(compress):