Skip to content

Commit 9d06e48

Browse files
ai: apply changes for #915 (1 review thread)
Addresses: - #3802164062 at src/databricks/sql/session.py:71 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
1 parent fde990f commit 9d06e48

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/databricks/sql/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _kernel_host_and_path(
7575
# unconditionally would otherwise yield a malformed double-``?``
7676
# path (e.g. ``/warehouses/abc?o=111?o=222``) that mis-parses
7777
# downstream and silently drops the org-id header.
78-
path = "{}?{}".format(path.split("?", 1)[0], parts.query)
78+
path = "{}?{}".format((path or "").split("?", 1)[0], parts.query)
7979
return host, path
8080

8181
port = kwargs.get("_port")

tests/unit/test_session.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,16 @@ def test_connection_uri_without_path_query_replaces_original_path_query(self):
792792
assert host == "https://h.example.com:8443"
793793
assert path == "/sql/1.0/warehouses/abc?o=222"
794794

795+
def test_connection_uri_without_path_and_none_http_path_applies_query(self):
796+
# http_path is legitimately nullable on the connect path. A path-less,
797+
# query-bearing URI combined with http_path=None must not raise; the
798+
# retained path coerces to empty before the query is applied.
799+
host, path = _kernel_host_and_path(
800+
self.HOST, None, {"_connection_uri": "https://h.example.com:8443?o=222"}
801+
)
802+
assert host == "https://h.example.com:8443"
803+
assert path == "?o=222"
804+
795805
def test_connection_uri_wins_over_port(self):
796806
host, path = _kernel_host_and_path(
797807
self.HOST,

0 commit comments

Comments
 (0)