From a3cf77a694b54d09c9be22de6525d283bb4022da Mon Sep 17 00:00:00 2001 From: Mikhail Beck Date: Tue, 18 Jun 2024 15:30:22 +0100 Subject: [PATCH] Improved bucketfs connection object creation (#121) --- exasol/nb_connector/extension_wrapper_common.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/exasol/nb_connector/extension_wrapper_common.py b/exasol/nb_connector/extension_wrapper_common.py index 6be7680..26bb658 100644 --- a/exasol/nb_connector/extension_wrapper_common.py +++ b/exasol/nb_connector/extension_wrapper_common.py @@ -1,5 +1,6 @@ from __future__ import annotations from typing import Optional, Any +import json import exasol.bucketfs as bfs # type: ignore @@ -139,15 +140,8 @@ def encapsulate_bucketfs_credentials( """ def to_json_str(**kwargs) -> str: - def format_value(v): - if isinstance(v, str): - return f'"{v}"' - elif isinstance(v, bool): - return str(v).lower() - return v - - return "{" + ", ".join(f'"{k}":{format_value(v)}' for k, v in kwargs.items() - if v is not None) + "}" + filtered_kwargs = {k: v for k,v in kwargs.items() if v is not None} + return json.dumps(filtered_kwargs) backend = get_backend(conf) if backend == StorageBackend.onprem: