Skip to content

Commit 5f7db3e

Browse files
test(kernel): simplify HTTP/2 option coverage
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
1 parent cbbd342 commit 5f7db3e

3 files changed

Lines changed: 7 additions & 22 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Install using `pip install databricks-sql-connector`
3535
Install using `pip install databricks-sql-connector[pyarrow]`
3636

3737
### Installing with the Rust kernel backend (`use_kernel=True`)
38-
3938
Install using `pip install databricks-sql-connector[kernel]`
4039

4140
This adds the optional [`databricks-sql-kernel`](https://pypi.org/project/databricks-sql-kernel/)
@@ -54,8 +53,9 @@ connection = sql.connect(
5453

5554
Notes:
5655
- HTTPS uses HTTP/2 with HTTP/1.1 fallback. `enable_http2=False` or configured
57-
proxy environment variables force HTTP/1.1 for all kernel traffic, including
58-
bypassed destinations.
56+
proxy environment variables force HTTP/1.1 for session requests, including
57+
bypassed destinations. Telemetry may reuse an earlier session's HTTP client
58+
for the same host.
5959
- Requires **Python >= 3.10** (the kernel wheel is published as
6060
`cp310-abi3`). On older interpreters the `[kernel]` extra installs
6161
nothing and `use_kernel=True` raises an `ImportError`.

‎src/databricks/sql/client.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ def __init__(
194194
Thrift/SEA paths, where an explicit ``True`` can still
195195
be suppressed by the feature flag.
196196
:param enable_http2: `bool`, optional (kernel default is True)
197-
Kernel backend only. Negotiate HTTP/2 for all kernel HTTPS
197+
Kernel backend only. Negotiate HTTP/2 for session HTTPS
198198
traffic, with HTTP/1.1 fallback. ``False`` or configured proxy
199199
environment variables force HTTP/1.1, including bypassed hosts.
200+
Telemetry may reuse an earlier session's HTTP client for the same host.
200201
:param enable_geospatial_support: `bool`, optional (default is False)
201202
Kernel backend only. Controls the public representation of
202203
``GEOMETRY`` and ``GEOGRAPHY`` result values. ``True`` returns

‎tests/unit/test_kernel_client.py‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -432,25 +432,9 @@ def fake_session(**kwargs):
432432
assert captured["enable_http2"] is enabled
433433

434434

435-
@pytest.mark.parametrize("value", ["false", 0, 1])
436-
def test_http2_option_rejects_non_boolean_through_connect(monkeypatch, value):
437-
from databricks import sql
438-
439-
native_session = MagicMock()
440-
auth_kwargs = MagicMock()
441-
monkeypatch.setattr(kernel_client._kernel, "Session", native_session)
442-
monkeypatch.setattr(kernel_client, "kernel_auth_kwargs", auth_kwargs)
435+
def test_http2_option_rejects_non_boolean():
443436
with pytest.raises(ValueError, match="enable_http2 must be a bool"):
444-
sql.connect(
445-
server_hostname="example.cloud.databricks.com",
446-
http_path="/sql/1.0/warehouses/abc",
447-
access_token="dapi-test",
448-
use_kernel=True,
449-
enable_telemetry=False,
450-
enable_http2=value,
451-
)
452-
native_session.assert_not_called()
453-
auth_kwargs.assert_not_called()
437+
kernel_client._kernel_http2_kwargs("false")
454438

455439

456440
@pytest.mark.parametrize("timeout", [None, 0, 12.5])

0 commit comments

Comments
 (0)