Skip to content

Commit 6477246

Browse files
authored
Upgrade databricks-sql-kernel to 1.0.0 (#938)
* chore: upgrade databricks-sql-kernel to 1.0.0 Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> * docs: remove stale kernel pin references Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> --------- Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
1 parent 5b5ab00 commit 6477246

4 files changed

Lines changed: 25 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Release History
22

33
# Unreleased
4+
- Upgraded the optional `databricks-sql-kernel` backend dependency to 1.0.0.
45
- Kernel metadata filters no longer collapse empty strings to `None`; empty patterns therefore match nothing. Existing `%`/`*` catalog wildcard handling is unchanged (PECOBLR-4221).
56
- Kernel backend (`use_kernel=True`): OAuth **M2M with a JWT private-key client assertion** (RFC 7523) is now supported. Pass `oauth_client_id` + `oauth_jwt_key_file` + `oauth_jwt_kid` (with optional `oauth_jwt_passphrase` for an encrypted PKCS#8 key, `oauth_jwt_algorithm` defaulting to `RS256`, `oauth_scopes`, and `token_url` for the IdP token endpoint) and the connector routes them to the kernel's `auth_type="oauth-m2m-jwt"`, which signs a short-lived assertion with the private key instead of sending a client secret. The kernel owns the token lifecycle. A private-key file is treated as unambiguous JWT M2M intent and is mutually exclusive with `oauth_client_secret` / `credentials_provider` (both raise `NotSupportedError`). Verified end-to-end against an Azure Databricks workspace with the service principal's public certificate registered on its Entra ID app registration. Requires `databricks-sql-kernel >= 0.2.0` with JWT support.
67
- Kernel backend (`use_kernel=True`): OAuth U2M with `auth_type="databricks-oauth"` now forwards the connector's `databricks-sql-python` OAuth-app bundle (`client_id` + `sql offline_access` scopes + redirect port) into the kernel, so a bare U2M connection authenticates as `databricks-sql-python` — parity with the Thrift path — instead of inheriting the kernel's own `databricks-sql-connector` default. A caller-supplied `oauth_client_id` (with its coupled `oauth_redirect_port`) is honored, as is a caller-supplied `oauth_scopes`; absent one, the connector default (`sql offline_access`) is forwarded. Note: the kernel binds a single U2M redirect port, so unlike the Thrift path (which tries the full `8020..8024` range) the kernel path uses only one port and does not fall back to the next port if it is already bound — pass `oauth_redirect_port` (with `oauth_client_id`) to pick a free one on a port collision (PECOBLR-4040)

poetry.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,37 +48,28 @@ pybreaker = "^1.0.0"
4848
requests-kerberos = {version = "^0.15.0", optional = true}
4949
# Optional Rust kernel backend for ``use_kernel=True`` (PyO3 wheel).
5050
# Pulled in only via the ``[kernel]`` extra below. The published wheel
51-
# is ``abi3`` with ``Requires-Python: >=3.10`` (built ``abi3-py310``),
52-
# so the dependency is gated to Python >= 3.10: on 3.8/3.9 the
53-
# ``[kernel]`` extra resolves to nothing and ``use_kernel=True`` raises
54-
# a clear ImportError at runtime (see backend/kernel/_errors.py).
51+
# is ``abi3`` with ``Requires-Python: >=3.9`` (built ``abi3-py39``); the
52+
# dependency remains gated to the connector's Python >= 3.10 support floor.
5553
#
56-
# Floor is 0.2.0 (``^0.2.0`` == ``>=0.2.0,<0.3.0``). The kernel is
57-
# pre-1.0, so each 0.x minor may carry breaking changes — the ``<0.3.0``
58-
# cap means we bump this deliberately when the kernel ships 0.3.0 rather
59-
# than letting a potentially-breaking minor flow in automatically. 0.2.0
60-
# keeps the same Requires-Python (>=3.10) and pyarrow (>=23.0.1,<24) pin
61-
# as 0.1.x, so the gating below is unchanged.
62-
databricks-sql-kernel = {version = "^0.2.0", optional = true, python = ">=3.10"}
54+
# Floor is 1.0.0 (``^1.0.0`` == ``>=1.0.0,<2.0.0``), allowing compatible
55+
# 1.x releases while keeping the next major upgrade deliberate. The kernel's
56+
# pyarrow constraint remains >=23.0.1,<24.
57+
databricks-sql-kernel = {version = "^1.0.0", optional = true, python = ">=3.10"}
6358

6459

6560
[tool.poetry.extras]
6661
pyarrow = ["pyarrow"]
6762
# ``pip install databricks-sql-connector[kernel]`` adds the Rust kernel
68-
# backend so ``use_kernel=True`` works. No-op on Python < 3.10 (the
69-
# wheel's floor) — those users get a runtime ImportError if they pass
70-
# ``use_kernel=True``.
63+
# backend so ``use_kernel=True`` works.
7164
#
7265
# The kernel result path (``backend/kernel/result_set.py``) needs
7366
# pyarrow, but it is NOT listed in this extra on purpose: the published
7467
# kernel wheel declares ``pyarrow>=23.0.1,<24`` as a hard runtime
7568
# dependency, so ``pip install ...[kernel]`` already pulls a compatible
7669
# pyarrow transitively. Listing bare ``pyarrow`` here additionally
7770
# forces poetry to co-resolve an unconstrained pyarrow against the
78-
# kernel's ``>=23.0.1,<24`` (which itself requires Python >=3.10) across
79-
# the connector's full 3.8–3.14 support matrix, which is unsatisfiable
80-
# on 3.8/3.9 and breaks ``poetry lock``. The kernel's own dependency
81-
# metadata is the single source of truth for the pyarrow floor.
71+
# kernel's ``>=23.0.1,<24``. The kernel's own dependency metadata is the
72+
# single source of truth for the pyarrow floor.
8273
kernel = ["databricks-sql-kernel"]
8374

8475
[tool.poetry.group.dev.dependencies]

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,10 @@ def _kernel_session_accepts_kwarg(name: str) -> bool:
154154
155155
The kernel ``Session`` is a PyO3 class with a **fixed** signature (no
156156
``**kwargs`` catch-all), so forwarding a kwarg it doesn't declare raises
157-
``TypeError`` at construction. The phase-7 identity/telemetry kwargs
158-
(``driver_name`` etc.) only exist on wheels newer than the pinned
159-
``^0.2.0`` (whose ``Session`` accepts none of them), so we must gate them
160-
on what the actually-installed wheel supports rather than pass them
161-
unconditionally. Falls **closed** (returns ``False``) when the signature
162-
can't be introspected: a PyO3 class only exposes ``__text_signature__``
163-
(and thus an introspectable signature) when built with
164-
``#[pyo3(signature=...)]``; otherwise ``inspect.signature`` raises
165-
``ValueError``. Since the pinned ``^0.2.0`` ``Session`` accepts none of
166-
these kwargs, forwarding one it doesn't declare is a hard ``TypeError`` at
167-
construction that breaks every ``use_kernel=True`` connection, whereas
168-
omitting one the wheel *would* have accepted only loses telemetry
169-
richness — so we omit the kwarg on introspection failure.
157+
``TypeError`` at construction, so we gate kwargs on what the installed
158+
wheel supports. Falls **closed** (returns ``False``) when the signature
159+
can't be introspected because omitting an accepted telemetry kwarg is safer
160+
than forwarding an unsupported one.
170161
"""
171162
try:
172163
params = inspect.signature(_kernel.Session).parameters
@@ -181,9 +172,7 @@ def _kernel_telemetry_kwargs(options: Dict[str, Any]) -> Dict[str, Any]:
181172
"""Build phase-7 telemetry/system kwargs for ``databricks_sql_kernel.Session``.
182173
183174
Only kwargs the installed ``Session`` constructor actually accepts are
184-
returned; on the pinned ``^0.2.0`` wheel (which predates phase 7) this is
185-
empty, so ``open_session`` doesn't break with ``TypeError`` on a wheel
186-
that doesn't yet know these kwargs.
175+
returned, preventing ``TypeError`` when the binding lacks an option.
187176
"""
188177
system = TelemetryHelper.get_driver_system_configuration()
189178
candidates: Dict[str, Any] = {

0 commit comments

Comments
 (0)