Skip to content

Commit

Permalink
Improved bucketfs connection object creation (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb authored Jun 18, 2024
1 parent 18b7c0a commit a3cf77a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions exasol/nb_connector/extension_wrapper_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations
from typing import Optional, Any
import json

import exasol.bucketfs as bfs # type: ignore

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a3cf77a

Please sign in to comment.