Skip to content

Commit 0d9126e

Browse files
Deprecate the SEA backend; steer users to the kernel path (#920)
The SEA backend (use_sea=True) has feature gaps — notably it does not support positional (`?`) parameter binding, which causes HTTP 400s against RT/Lakehouse warehouses. Rather than partially patch SEA, mark it deprecated and steer users to the supported kernel backend (use_kernel=True), which is SEA-native and handles positional/named parameter binding. - Emit a warning at SeaDatabricksClient construction pointing users to use_kernel=True + the `[kernel]` extra. - Document use_sea as deprecated/incomplete in the connect() docstring, and refresh the stale use_kernel docstring (it now ships on PyPI via the `[kernel]` extra and supports parameter binding). - Flag the SEA example harness and the CONTRIBUTING backend table as deprecated. SEA stays functional (RT warehouses refuse Thrift, so it can't simply be rerouted) and is slated for eventual removal. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent 0a8f1d2 commit 0d9126e

5 files changed

Lines changed: 56 additions & 12 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ reproduce on a SEA or kernel connection, and vice versa:
153153
| Backend | Select via (connect kwarg / `extra_params`) | Where its tests live |
154154
| --- | --- | --- |
155155
| **Thrift** (default) | *(nothing — the default path)* | the general `tests/e2e` suite (the `{}` parametrize case) and mocked `tests/unit` |
156-
| **SEA** (Statement Execution API) | `use_sea=True` | the general `tests/e2e` suite (the `{"use_sea": True}` parametrize case, e.g. `tests/e2e/test_driver.py`) and mocked `tests/unit` |
156+
| **SEA** (Statement Execution API) *(deprecated — use Kernel for SEA-native connections)* | `use_sea=True` | the general `tests/e2e` suite (the `{"use_sea": True}` parametrize case, e.g. `tests/e2e/test_driver.py`) and mocked `tests/unit` |
157157
| **Kernel** (Rust, optional) | `use_kernel=True` | the dedicated `tests/e2e/test_kernel_backend.py` / `test_kernel_tls.py`, plus the offline routing test `tests/unit/test_session.py -m realkernel` |
158158

159159
Notes that matter when running the suite:

examples/experimental/sea_connector_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"""
22
Main script to run all SEA connector tests.
33
4+
DEPRECATED: the pure-Python SEA backend (``use_sea=True``) exercised by
5+
these examples is incomplete (e.g. no positional ``?`` parameter binding)
6+
and slated for removal. For a SEA-native connection use ``use_kernel=True``
7+
instead — install it with ``pip install 'databricks-sql-connector[kernel]'``.
8+
49
This script runs all the individual test modules and displays
510
a summary of test results with visual indicators.
611

src/databricks/sql/backend/sea/backend.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ def __init__(
151151
http_path,
152152
)
153153

154+
# The SEA backend is deprecated and incomplete (e.g. it does not
155+
# support positional parameter binding) and is slated for removal.
156+
# Steer users to the Rust kernel backend, which is the supported path.
157+
logger.warning(
158+
"The SEA backend (use_sea=True) is deprecated and incomplete and "
159+
"should not be used in production; it is slated for removal. Use "
160+
"the kernel backend instead by passing use_kernel=True and "
161+
"installing the kernel extra: "
162+
"pip install 'databricks-sql-connector[kernel]'."
163+
)
164+
154165
self._max_download_threads = kwargs.get("max_download_threads", 10)
155166
self._ssl_options = ssl_options
156167
self._use_arrow_native_complex_types = kwargs.get(

src/databricks/sql/client.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,23 @@ def __init__(
117117
:param use_sea: `bool`, optional (default is False)
118118
Use the native pure-Python SEA backend instead of
119119
the Thrift backend.
120+
121+
Deprecated and incomplete — this backend has feature
122+
gaps (e.g. it does not support positional ``?``
123+
parameter binding) and is slated for removal. For a
124+
SEA-native connection use ``use_kernel=True`` instead,
125+
which is the supported path.
120126
:param use_kernel: `bool`, optional (default is False)
121127
Route the connection through the Rust kernel
122-
(``databricks-sql-kernel`` via PyO3). Requires the
123-
kernel extension to be installed separately — the
124-
wheel is not yet published on PyPI, so today the
125-
only supported install path is a local
126-
``maturin develop --release`` build from the
127-
``databricks-sql-kernel`` repo into the same venv.
128-
Raises ``ImportError`` if the extension is not
129-
available. In active development — PAT auth only
130-
today; OAuth / federation / external credentials
131-
and native parameter binding land in follow-ups.
132-
Mutually exclusive with ``use_sea``.
128+
(``databricks-sql-kernel`` via PyO3), a SEA-native
129+
client. Requires the kernel extension, installed via
130+
the ``[kernel]`` extra:
131+
``pip install 'databricks-sql-connector[kernel]'``.
132+
Needs Python >= 3.10; on older interpreters the extra
133+
is a no-op and ``use_kernel=True`` raises a clear
134+
``ImportError``. Supports PAT, OAuth M2M, and OAuth
135+
U2M auth, and native (positional and named) parameter
136+
binding. Mutually exclusive with ``use_sea``.
133137
:param use_hybrid_disposition: `bool`, optional (default is False)
134138
Use the hybrid disposition instead of the inline disposition.
135139
:param server_hostname: Databricks instance host name.

tests/unit/test_sea_backend.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,30 @@ def test_initialization(self, mock_http_client):
200200
)
201201
assert "Could not extract warehouse ID" in str(excinfo.value)
202202

203+
def test_initialization_warns_backend_incomplete(self, mock_http_client, caplog):
204+
"""Constructing a SEA client emits a warning steering users to the
205+
kernel backend, since the SEA path is incomplete and slated for
206+
deprecation."""
207+
import logging
208+
209+
with caplog.at_level(
210+
logging.WARNING, logger="databricks.sql.backend.sea.backend"
211+
):
212+
SeaDatabricksClient(
213+
server_hostname="test-server.databricks.com",
214+
port=443,
215+
http_path="/sql/warehouses/abc123",
216+
http_headers=[],
217+
auth_provider=AuthProvider(),
218+
ssl_options=SSLOptions(),
219+
)
220+
221+
warnings = [r.message for r in caplog.records if r.levelno == logging.WARNING]
222+
assert any(
223+
"incomplete" in m and "use_kernel=True" in m and "[kernel]" in m
224+
for m in warnings
225+
), warnings
226+
203227
def test_session_management(self, sea_client, mock_http_client, thrift_session_id):
204228
"""Test session management methods."""
205229
# Test open_session with minimal parameters

0 commit comments

Comments
 (0)