Skip to content

docs: describe SOCKS proxies from the environment on the kernel backend - #1082

Merged
cathleeny merged 1 commit into
mainfrom
cathleeny/ddf-socks-proxy-python
Dec 3, 2026
Merged

cathleeny merged 1 commit into
mainfrom
cathleeny/ddf-socks-proxy-python

Conversation

@cathleeny

@cathleeny cathleeny commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • Other (documentation)

Description

Documents in CONNECTION_PARAMETERS.md how SOCKS proxies from environment variables behave on each backend, and moves KERNEL_REV (the kernel the kernel-e2e workflow builds) to the merged SOCKS kernel commit a29235c. No connector code, option or default changes.

  • Kernel (use_kernel=True, with a databricks-sql-kernel release that includes feat(client): support SOCKS4/4a/5/5h proxies databricks-sql-kernel#518): only the socks4://, socks4a://, socks5:// and socks5h:// SOCKS schemes are supported, in HTTPS_PROXY, or in ALL_PROXY when HTTPS_PROXY is unset. They apply to all kernel traffic (queries, CloudFetch downloads and OAuth), and NO_PROXY hosts connect directly. A value with another scheme, such as bare socks://, is ignored. socks5/socks4 resolve the target locally; socks5h/socks4a let the proxy resolve it. SOCKS5 credentials go in the URL userinfo; SOCKS4 sends no user ID. An unreachable proxy or rejected credentials fail the connection, with no direct fallback.
  • Thrift has no SOCKS support: a SOCKS HTTPS_PROXY fails with urllib3's ProxySchemeUnknown, and ALL_PROXY is ignored.

How is this tested?

  • Unit tests
  • E2E Tests (live, through sql.connect with a locally built kernel wheel)
  • Manually
  • N/A

Live against staging DBSQL and Reyden warehouses with a wheel built from kernel a29235c, through a loopback SOCKS4/4a/5 fixture that records each handshake:

  • SELECT 1 and a 200,000-row CloudFetch query through socks5h, socks5, socks4a and socks4, with the DNS mode documented above.
  • ALL_PROXY alone, HTTPS_PROXY taking precedence over ALL_PROXY, and NO_PROXY hosts going direct.
  • Bare socks:// in HTTPS_PROXY is ignored: the kernel connects directly, or uses ALL_PROXY when it's set.
  • Correct credentials, wrong credentials (rejected after one attempt) and a dead proxy, which fails closed with no direct connection.
  • Thrift in the same session: ProxySchemeUnknown for a SOCKS HTTPS_PROXY; ALL_PROXY ignored.
  • SELECT 1 through socks5h was within max(+25 %, +150 ms) of direct on DBSQL in both runs. On Reyden it was within in the second run; in the first run Reyden's own direct samples ranged from 0.8 to 2 s.

The unit tests pass, as do the real-kernel tests against that wheel.

Related Tickets & Documents

This pull request and its description were written by Isaac.

@cathleeny
cathleeny marked this pull request as ready for review December 1, 2026 19:42

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Docs-only change. Looks accurate, with 1 medium concern: the kernel support claim isn't tied to any released kernel version. The Thrift behavior described matches the urllib3 ProxyManager path in thrift_http_client.py.

Comment thread CONNECTION_PARAMETERS.md Resolved

@aakash-saravanan-db aakash-saravanan-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This keeps the connector API unchanged and explains the kernel's environment-based SOCKS support, DNS modes, credentials, and differences from Thrift in one place.

There's one documentation correction inline: unsupported environment values are ignored by the underlying proxy parser, so the text should distinguish that from failures through a supported SOCKS proxy. The compatible kernel release remains a separate prerequisite, as already noted.

Please also shorten the PR description to the public behavior, dependencies, and relevant validation, removing internal tracking details and prior-review history.


This review was generated with GitHub MCP.

Comment thread CONNECTION_PARAMETERS.md Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 Low

Docs-only change: 2 concerns about how accurate and how clear the new SOCKS section is. No code changes.

Comment thread CONNECTION_PARAMETERS.md Resolved
Comment thread CONNECTION_PARAMETERS.md Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Nit

Looks good: a docs-only change with no blocking issues. The Thrift claims match the code: detect_and_parse_proxy reads only the scheme key from urllib.request.getproxies(), so ALL_PROXY is ignored, and ProxyManager rejects SOCKS URLs. The new anchor link resolves.

Other findings

  • ⚪ Nit — The new section says both backends read proxies from the environment. The deprecated SEA backend also builds a urllib3 ProxyManager, and the section doesn't mention it. The doc deliberately omits a SEA column, so this is minor. Add a one-line note that SEA behaves like Thrift. (Found by Claude Opus 5.5 · confirmed by the judge)

@cathleeny

Copy link
Copy Markdown
Collaborator Author

On the review's nit (mention the deprecated SEA backend): leaving the section as is. It covers the two supported backends, Thrift and kernel, and deliberately has no SEA column, as the nit notes. The deprecated SEA backend uses the same urllib3 ProxyManager path as Thrift, so the Thrift bullet already describes its SOCKS behavior.

@aakash-saravanan-db aakash-saravanan-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! The SOCKS documentation clearly explains the environment settings and backend differences. LGTM.


This review was generated with GitHub MCP.

Once the installed databricks-sql-kernel supports SOCKS, use_kernel=True
connections honor socks4/socks4a/socks5/socks5h URLs in HTTPS_PROXY, or
in ALL_PROXY when HTTPS_PROXY is unset, with NO_PROXY bypass, through the
kernel's existing environment-proxy handling. The connector needs no code
change for this.

Record it in CONNECTION_PARAMETERS.md as a documented difference from
Thrift: the variables honored, DNS per scheme (socks5/socks4 resolve
locally, socks5h/socks4a at the proxy), credentials as URL userinfo,
fail-closed behavior, and that Thrift raises ProxySchemeUnknown for a
SOCKS HTTPS_PROXY and ignores ALL_PROXY.

Bump KERNEL_REV to a29235cbea9532efa5572ebff010045583a19cbe, the merged
kernel SOCKS change (databricks/databricks-sql-kernel#518), so kernel-e2e
builds a wheel that supports SOCKS proxies.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-python branch from 92e1ab7 to 1edd69d Compare December 2, 2026 23:01

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Nit

Looks good — 1 low concern. The Thrift claims match the code (getproxies().get(scheme) only). The description says nothing changes except docs, but it doesn't mention the KERNEL_REV bump, which changes the kernel source CI builds against. Adding an in-repo SOCKS E2E is follow-up work.

Other findings

  • ⚪ Nit — The doc says only "a databricks-sql-kernel release that supports SOCKS", so users can't tell which kernel version they need. The _port row names the specific kernel PR it depends on. Name the kernel PR or the release version here too, once it ships. (Found by Claude Opus 5.5 · confirmed by the judge)

@cathleeny

Copy link
Copy Markdown
Collaborator Author

On the latest review's nits:

  • KERNEL_REV bump in the description: the description now covers it ("moves KERNEL_REV ... to the merged SOCKS kernel commit a29235c").
  • Naming the kernel version in the doc: leaving it for now. No databricks-sql-kernel release includes SOCKS yet, so there's no version to name. The change that moves the [kernel] dependency to that release will name it here.

@cathleeny
cathleeny added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 72ac235 Dec 3, 2026
52 of 53 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 1edd69d0 Deployed Dec 3, 2026 by cathleeny via test-with-coverage #1431
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants