Uh oh!
There was an error while loading. Please reload this page.
feat(kernel): statement query tags + http_headers/user_agent_entry on use_kernel - #823
Conversation
…use_kernel Consume the kernel surface from kernel PR (query tags + custom HTTP headers) on the use_kernel path. Bumps KERNEL_REV. Query tags (statement-level): - execute_command no longer raises NotSupportedError for query_tags; it calls stmt.set_query_tags(query_tags) after set_sql. The connector already passes Dict[str, Optional[str]], which the kernel accepts (None value -> bare key in the SEA query_tags conf). http_headers + user_agent_entry: - The kernel client now forwards http_headers to the kernel Session as the `http_headers` kwarg (was accept-and-ignore). session.py already passes all_headers, which carries the connector's composed User-Agent (PyDatabricksSqlConnector/x (entry)) + caller headers + SPOG org-id. - The kernel applies them per request: its own Authorization / org-id win; a caller User-Agent is APPENDED to the kernel base UA (the base carries the DatabricksJDBCDriverOSS token that gates the SEA result disposition, so it's never replaced). So user_agent_entry is honored end-to-end via the existing http_headers forwarding — no separate kwarg needed. Tests: - unit: query_tags forwarded to set_query_tags (was: rejection test); http_headers forwarded to the kernel Session (and omitted when empty). - e2e (test_kernel_backend.py): a query_tagged query and a connection with user_agent_entry + a custom http_header both round-trip green against a dogfood warehouse. The UA case specifically guards the append behavior (replacing the base UA would 400 on the result disposition). KERNEL_REV -> c2053f68b75fef4a29425096dc6bbafb774d8b83 (kernel PR #119 branch HEAD; re-pin to the squash-merge SHA once #119 lands). 194 kernel unit tests pass; black + mypy clean; 3 e2e pass live. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
gopalldb
commented
Jun 3, 2026
🔴 P0 — Block Merge KERNEL_REV pins an unmerged-kernel-PR HEAD (KERNEL_REV:1)
🟡 P1
🟢 P2
|
…aders Addresses @gopalldb's review on #823. P1.1 — secret scrub now covers a kwarg-build failure: - open_session built auth/tls/retry/http_headers kwargs OUTSIDE the try whose finally scrubs oauth_client_secret. A raise in kernel_auth_kwargs (e.g. OAuth token-exchange failure with the M2M secret in hand) would skip the scrub, leaking the secret onto the long-lived connector. Moved all kwarg builds inside the try (auth_kwargs / tls_kwargs pre-declared empty so the finally can reference them on an early raise). P1.3 / P2 — don't forward kernel-managed headers: - The connector now drops Authorization and x-databricks-org-id from http_headers before forwarding to the kernel (new _KERNEL_MANAGED_HEADERS set). The kernel manages both (auth from the provider; org-id re-derived from ?o= in http_path), so forwarding is redundant — and the connector always injects the SPOG org-id, which the kernel skips-and-warns per request, so this also kills the WARN spam. Double-walls the kernel's own reserved-name skip. Tests: - unit: Authorization / x-databricks-org-id dropped before forwarding; only-reserved-headers omits the kwarg entirely (test_kernel_client). - P1.2: user_agent_entry reaches the kernel client's http_headers on use_kernel=True (test_session) — guards a regression where session.py stops folding the entry into the composed User-Agent. CHANGELOG: deferred to release-cut per repo convention (entries are added at version bump, not per-PR; #819/#820 followed the same). 197 kernel unit tests pass; black + mypy clean; 3 e2e pass live. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
vikrantpuppala
commented
Jun 3, 2026
Thanks @gopalldb — addressed in P0 — KERNEL_REV pins unmerged #119 HEAD P1
P2
197 kernel unit tests pass; black + mypy clean; 3 e2e pass live against dogfood (incl. query_tags + user_agent_entry/http_headers round-trips). |
#119 (statement query tags + custom HTTP headers) is now merged to kernel main. Re-pin from the orphaned branch HEAD (c2053f6) to the current merged main HEAD (101aa46), which contains #119's merge commit (df8302f) and is reachable from main — no orphan-SHA risk. Verified end-to-end against a wheel built from 101aa46: kernel e2e (query_tags_round_trip, user_agent_entry + http_headers round_trip, select_one) all pass. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What
Connector follow-up to kernel PR #119. Wires two features onto the
use_kernelpath and bumpsKERNEL_REV:cursor.execute(..., query_tags=...)now works onuse_kernel(wasNotSupportedError).http_headers+user_agent_entry— both now reach the kernel.Query tags
execute_commandcallsstmt.set_query_tags(query_tags)afterset_sqlinstead of rejecting. The connector already hands aDict[str, Optional[str]], which the kernel accepts directly (aNonevalue → bare key in the SEAquery_tagsconf).http_headers + user_agent_entry
http_headersto the kernelSession(http_headerskwarg) — previously accept-and-ignored.session.pyalready passesall_headers, which carries the connector's composedUser-Agent(PyDatabricksSqlConnector/x (entry)) + any caller headers + the SPOGx-databricks-org-id.Authorization/x-databricks-org-idwin; a callerUser-Agentis appended to the kernel base UA (the base carries theDatabricksJDBCDriverOSStoken that gates the SEA result disposition, so it's never replaced).user_agent_entryis honored end-to-end via the existinghttp_headersforwarding — no separate kwarg needed.Verification
set_query_tags(replaces the old rejection test);http_headersforwarded to the kernel Session (and omitted when empty). 194 kernel unit tests pass.test_kernel_backend.py): a query-tagged query, and a connection withuser_agent_entry+ a customhttp_header, both round-trip green against a dogfood warehouse. The UA case specifically guards the append behavior — replacing the base UA would 400 on the result disposition.black+mypyclean.Caveat
KERNEL_REVcurrently pins kernel PR #119's branch HEAD (c2053f68…) so this PR's CI can build against the newset_query_tags/http_headerssurface. Re-pin to the squash-merge SHA once #119 lands before merging this.This pull request and its description were written by Isaac.