Repository navigation
feat(kernel): honor _port and _connection_uri on use_kernel connections #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
db9a0fe
d98ca45
5bb846e
6a78cef
8f96c0b
6250c28
f27c165
c90459f
bc7c09e
bdeef64
f242c0f
5082c7e
0de7c86
a6936af
973b4e2
81c1cff
233f2b5
12ed5dc
6272ae0
01999fa
1453b26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 5c3a909771f749174567af074bfe18c24a335f5c | ||
| 22ae6ec250837b38d0e3dc720310d4dcfb81fa98 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -238,6 +238,22 @@ def _kernel_geospatial_kwargs(value: bool) -> Dict[str, bool]: | |
| return {"enable_geospatial_support": value} | ||
|
|
||
|
|
||
| def _kernel_port_kwargs(port: Optional[int]) -> Dict[str, int]: | ||
| """Build the kernel ``port`` kwarg. Only a port that applies is passed: unset, 0 and the | ||
| default 443 send nothing, so the default path sends the same kwargs as before. The kernel | ||
| applies the port to ``host``. A wheel without the kwarg raises rather than silently | ||
| connecting to the default port. | ||
| """ | ||
| if not port or port == 443: | ||
| return {} | ||
| if not _kernel_session_accepts_kwarg("port"): | ||
| raise NotSupportedError( | ||
| "_port requires a newer databricks-sql-kernel wheel that exposes the " | ||
| "port kwarg." | ||
| ) | ||
| return {"port": port} | ||
|
|
||
|
|
||
| def _validate_telemetry_flush_interval_ms(value: Any) -> None: | ||
| # PyO3 would accept True as 1ms and report other bad values without | ||
| # naming the option, so reject them before the kernel sees them. | ||
|
|
@@ -321,10 +337,12 @@ def __init__( | |
| # toggles, mTLS client cert/key). ``http_headers`` is forwarded | ||
| # to the kernel as custom request headers (it carries the | ||
| # connector's composed ``User-Agent`` + any caller headers + the | ||
| # SPOG ``x-databricks-org-id``). ``http_client`` / ``port`` are | ||
| # still accept-and-ignore — the kernel manages its own HTTP | ||
| # stack. | ||
| # SPOG ``x-databricks-org-id``). ``port`` (the resolved ``_port``, | ||
| # or ``None``) is forwarded as the kernel's ``port`` kwarg, which | ||
| # the kernel applies to ``server_hostname``. ``http_client`` is | ||
| # accept-and-ignore — the kernel manages its own HTTP stack. | ||
| self._server_hostname = server_hostname | ||
| self._port: Optional[int] = kwargs.get("port") | ||
| self._http_path = http_path | ||
| self._auth_provider = auth_provider | ||
| self._ssl_options = ssl_options | ||
|
|
@@ -488,6 +506,7 @@ def open_session( | |
| geospatial_kwargs = _kernel_geospatial_kwargs( | ||
| self._enable_geospatial_support | ||
| ) | ||
| port_kwargs = _kernel_port_kwargs(self._port) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High — The dependency floor stays at ^1.5.0 although the feature needs a kernel release containing kernel#505. The driver raises a clear NotSupportedError on older wheels, but the published-wheel realkernel CI tier cannot pass until the floor and lockfile move. Bump the floor and lockfile once that kernel is released. 🔀 Found by GPT-6.1 Sol · confirmed by the judge |
||
| max_connections_kwargs: Dict[str, Any] = {} | ||
| if _kernel_session_accepts_kwarg("max_connections"): | ||
| max_connections_kwargs["max_connections"] = self._max_connections | ||
|
|
@@ -536,6 +555,7 @@ def open_session( | |
| **retry_kwargs, | ||
| **telemetry_kwargs, | ||
| **geospatial_kwargs, | ||
| **port_kwargs, | ||
| **max_connections_kwargs, | ||
| **http_headers_kwargs, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Low — The dependency floor is still ^1.5.0, so a released install without the
portkwarg raises NotSupportedError for a non-default_port. The failure is explicit, not silent. Once the kernel release with #505 is published, raise the floor and update the lockfile.🔀 Found by GPT-6.1 Sol · confirmed by the judge