Skip to content

Commit 4ba9d74

Browse files
fix(kernel): delegate CloudFetch policy to native client configuration
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
1 parent 0d12e2d commit 4ba9d74

3 files changed

Lines changed: 10 additions & 18 deletions

File tree

‎KERNEL_REV‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c58f62c95f3651488f6270c0b45686614486d351
1+
dccdcb58ecba1bf2f74066c47dd4a98dbe81cfeb

‎src/databricks/sql/backend/kernel/client.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,19 +391,13 @@ def open_session(
391391
) -> SessionId:
392392
if self._kernel_session is not None:
393393
raise InterfaceError("KernelDatabricksClient already has an open session.")
394-
# ``session_configuration`` flows through to the kernel's
395-
# ``session_conf`` map verbatim; the SEA endpoint enforces
396-
# its own allow-list and rejects unknown keys.
394+
# The kernel consumes client settings locally before forwarding server parameters.
397395
session_conf: Optional[Dict[str, str]] = None
398396
if session_configuration:
399397
session_conf = {k: str(v) for k, v in session_configuration.items()}
400398
if not self._use_cloud_fetch:
401-
session_conf = {
402-
k: v
403-
for k, v in (session_conf or {}).items()
404-
if k.lower() != "can_cloud_download"
405-
}
406-
session_conf["can_cloud_download"] = "false"
399+
session_conf = session_conf or {}
400+
session_conf["cloudfetch_enabled"] = "false"
407401
# The kwarg builds run INSIDE the try so the ``finally`` scrub
408402
# below always fires — including when ``kernel_auth_kwargs``
409403
# itself raises mid-build (e.g. an OAuth token-exchange failure

‎tests/unit/test_kernel_client.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,21 @@ def fake_session(**kw):
353353
{"can_cloud_download": "false"},
354354
{"can_cloud_download": "false"},
355355
),
356-
({"use_cloud_fetch": False}, None, {"can_cloud_download": "false"}),
356+
({"use_cloud_fetch": False}, None, {"cloudfetch_enabled": "false"}),
357357
(
358358
{"use_cloud_fetch": False},
359359
{"TIMEZONE": "UTC"},
360-
{"TIMEZONE": "UTC", "can_cloud_download": "false"},
360+
{"TIMEZONE": "UTC", "cloudfetch_enabled": "false"},
361361
),
362362
(
363363
{"use_cloud_fetch": False},
364364
{"can_cloud_download": "true"},
365-
{"can_cloud_download": "false"},
365+
{"can_cloud_download": "true", "cloudfetch_enabled": "false"},
366366
),
367367
(
368368
{"use_cloud_fetch": False},
369-
{"Can_Cloud_Download": "true"},
370-
{"can_cloud_download": "false"},
369+
{"CLOUDFETCH_ENABLED": "true", "cloudfetch_enabled": "true"},
370+
{"CLOUDFETCH_ENABLED": "true", "cloudfetch_enabled": "false"},
371371
),
372372
],
373373
)
@@ -445,9 +445,7 @@ def fake_session(**kw):
445445

446446

447447
@pytest.mark.parametrize("enabled", [True, False])
448-
def test_open_session_passes_geospatial_representation_to_kernel(
449-
monkeypatch, enabled
450-
):
448+
def test_open_session_passes_geospatial_representation_to_kernel(monkeypatch, enabled):
451449
captured = {}
452450

453451
def fake_session(*, enable_geospatial_support=True, **kw):

0 commit comments

Comments
 (0)