You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support cursor.rowcount for DML on the Thrift backend (#784)
cursor.rowcount was hardcoded to -1 and never updated for the Thrift
backend (the default). For DML (INSERT/UPDATE/DELETE/MERGE) the
Databricks Thrift server reports the affected-row count in
TGetOperationStatusResp.numModifiedRows, but the connector discarded it —
_wait_until_command_done kept only operationState.
Thread numModifiedRows through: _wait_until_command_done now returns the
terminal status response, _handle_execute_response reads numModifiedRows
from it, ExecuteResponse and ResultSet carry a num_modified_rows field,
and Cursor.execute sets self.rowcount from it. rowcount resets to -1
before each statement so a DML count never leaks into a later SELECT.
SELECT (and statements the server does not report a count for) leave
rowcount at its -1 default. This brings the Thrift path in line with the
kernel backend, which already surfaces num_modified_rows.
Closes#784
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# Release History
2
2
3
+
# Unreleased
4
+
- Report `cursor.rowcount` for DML on the Thrift backend: INSERT/UPDATE/DELETE/MERGE now set `rowcount` to the server's affected-row count instead of the hardcoded `-1`; SELECT (and statements the server does not report a count for) still return `-1` ([#784](https://github.com/databricks/databricks-sql-python/issues/784))
5
+
3
6
# 4.3.0 (2026-06-12)
4
7
-**New: optional Rust kernel backend (`use_kernel=True`).** Adds an alternative connection path backed by the native [`databricks-sql-kernel`](https://pypi.org/project/databricks-sql-kernel/) client (a Rust core exposed via PyO3), installable with the new `databricks-sql-connector[kernel]` extra. The kernel talks to Databricks over the **SEA (Statement Execution API) HTTP transport** — not Thrift — with CloudFetch and inline-Arrow result fetching, so `use_kernel=True` gives you a modern SEA-native client through the same DB-API surface. Supports PAT, OAuth M2M, and OAuth U2M auth. Requires Python >= 3.10 (the kernel wheel is `cp310-abi3`); on older interpreters the extra is a no-op and `use_kernel=True` raises a clear `ImportError`. The default backend remains Thrift — opt in per connection.
5
8
- Kernel backend behavior is aligned with the Thrift backend so application code works the same either way: consistent cursor-state tracking (`query_id` / `get_query_state`), metadata (catalogs/schemas/tables/columns with JDBC-style filter semantics and case-insensitive `table_types`), DML `rowcount`, server-sourced async execution state, sync `cancel()`, fail-loud staging/volume operations, and structured error context (SQLSTATE, diagnostic info). Kernel logs surface through Python `logging` under the `databricks.sql.kernel` logger (databricks/databricks-sql-python#824, #825, #830, #838, #839 by @vikrantpuppala)
0 commit comments