Skip to content

feat(sea): send per-statement query tags on the wire (native query_tags array) - #150

Merged
msrathore-db merged 2 commits into
mainfrom
msrathore/sea-statement-query-tags
Jun 10, 2026
Merged

msrathore-db merged 2 commits into
mainfrom
msrathore/sea-statement-query-tags

Conversation

@msrathore-db

Copy link
Copy Markdown
Collaborator

Problem

Per-statement query tags set via Statement::query_tags (the napi/pyo3 set_query_tags bindings) — or a raw statement_conf["query_tags"] — were stored on the spec but never sent to the server. build_execute_params ignored statement_conf, and ExecuteStatementRequest had no conf/query-tags field, so the SEA POST /statements body dropped them silently.

This was confirmed on a live warehouse (mitmproxy capture): a tagged statement's /statements body contained no query_tags. It affects every binding on the SEA path — Node.js useSEA and Python use_kernel — while the Thrift path sends them via confOverlay.query_tags (verified on the wire). So the two backends were not at parity.

Fix

The SEA API takes query tags as a native top-level query_tags array of {key, value} objects — the same wire shape the pure-Python SEA backend and the ADBC C# driver already send (the SEA request has no conf overlay, unlike Thrift). This wires that:

  • types::sea: add QueryTag { key, value } and query_tags: Vec<QueryTag> on ExecuteStatementRequest (omitted when empty) and ExecuteParams.
  • spec: add deserialize_query_tags — the inverse of the existing serialize_query_tags escaping — so the single serialized conf string (where both input paths converge) is converted to the structured array.
  • build_execute_params: populate ExecuteParams.query_tags from statement_conf["query_tags"]. Covers all execute paths (sync, async/submit, direct) since they share the params builder and call_execute_api.

No binding API changes: Statement::query_tags is unchanged; the conversion happens at the wire boundary.

Result

  • Per-statement query tags now reach the server on SEA → parity with Thrift, for both Node useSEA and Python use_kernel.
  • Session-level query tags (QUERY_TAGS session conf) already reach the wire via the session-conf allowlist — unchanged.

Tests

  • deserialize_query_tags: round-trip with serialize_query_tags, plus escaping edge cases (value \:/\,/\\, key backslash, bare key → None, empty value after colon).
  • build_execute_params: threads tags into the native array; empty when none set.
  • ExecuteStatementRequest: serializes the native [{key,value}] shape with value omitted for bare keys; empty array omitted.
  • Full lib suite green (656 tests), clippy clean.

This pull request and its description were written by Isaac.

…gs array)

Per-statement query tags set via `Statement::query_tags` (napi/pyo3
`set_query_tags`) or a raw `statement_conf["query_tags"]` were stored on
the spec but never reached the server: `build_execute_params` ignored
`statement_conf` and `ExecuteStatementRequest` had no conf/query_tags
field, so the SEA `POST /statements` body dropped them silently. (The SEA
API has no conf overlay, unlike Thrift's `confOverlay`.)

The SEA API takes query tags as a native top-level `query_tags` array of
`{key, value}` objects — the same wire shape the pure-Python SEA backend
and the ADBC C# driver send. This wires that:

- `types::sea`: add `QueryTag { key, value }` + `query_tags: Vec<QueryTag>`
  on `ExecuteStatementRequest` (skipped when empty) and `ExecuteParams`.
- `spec`: add `deserialize_query_tags` — the inverse of the existing
  `serialize_query_tags` escaping — so the single serialized conf string
  (where both input paths converge) is converted to the structured array.
- `build_execute_params`: populate `ExecuteParams.query_tags` from
  `statement_conf["query_tags"]`. Applies to all execute paths (sync,
  async/submit, direct) since they share the params builder + call_execute_api.

Fixes per-statement query tags for every binding on the SEA path (Node
`useSEA` and Python `use_kernel`), bringing them to parity with Thrift's
`confOverlay.query_tags`. Session-level query tags (`QUERY_TAGS` session
conf) already reach the wire via the session-conf allowlist.

Tests: deserialize round-trip + escaping edge cases; build_execute_params
threads tags to the array; request serializes the native `[{key,value}]`
shape with value omitted for bare keys.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
@msrathore-db
msrathore-db force-pushed the msrathore/sea-statement-query-tags branch from a1eb79d to 273c1fc Compare June 9, 2026 10:16
@msrathore-db
msrathore-db added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 34b4c20 Jun 10, 2026
15 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 273c1fcf Deployed Jun 9, 2026 by msrathore-db via v0 E2E surface #159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants