Skip to content

fix(python): expose async affected-row counts - #432

Merged
aakash-saravanan-db merged 2 commits into
mainfrom
aakash-saravanan-db/fix-python-async-rowcount
Nov 11, 2026
Merged

aakash-saravanan-db merged 2 commits into
mainfrom
aakash-saravanan-db/fix-python-async-rowcount

Conversation

@aakash-saravanan-db

@aakash-saravanan-db aakash-saravanan-db commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Python async statement and reader handles do not expose the affected-row count that Rust already caches. The connector therefore cannot populate cursor.rowcount after async DML completion.

Expose num_modified_rows getters on both Python handle types and delegate the Rust reader accessor to its existing statement count. Preserve positive, zero, and unavailable counts without adding polling or consuming result rows.

Validation:

  • Full kernel unit, integration, and doc suite: 1,287 passed, zero failed, 63 ignored.
  • Root and PyO3 all-target Clippy with warnings denied; Rust formatting passed.
  • PyO3 tests: 12 passed, 37 live tests skipped. Regression cases fail against the published 1.4.0 wheel because the getter is absent.
  • Native connector reader tests: four passed, covering standard and realtime routes.
  • Changed connector plus rebuilt wheel on staging DBSQL: 28/28 DML cases, including positive/zero async INSERT, UPDATE, DELETE, MERGE, parameter binding, CTE INSERT, synchronous controls, counter-row preservation, table contents, and kernel reader re-fetches.

Companion Python connector PR: databricks/databricks-sql-python#1016. The connector requires a kernel release containing these getters.

@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.

Verdict: 1 Low

Looks good: the change is small and well tested. One low concern: the owner-side getter raises after close(), while statement_id and the reader's getter keep working after close.

Comment thread pyo3/src/executed_async.rs 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.

Verdict: 1 Low

Looks good. The change is small and contained. The new getters correctly check validity before and after reading the cached count, and they cover invalidation after a re-submit and after the owner is released. One low-severity gap: no mocked test checks a positive count.

Comment thread pyo3/tests/test_async.py 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.

✅ No issues identified by the review bot.

Expose the existing cached affected-row count on Python async statement and reader handles so connector result retrieval can report it without consuming rows.

Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>

@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.

✅ No issues identified by the review bot.

@aakash-saravanan-db
aakash-saravanan-db added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 453017f Nov 11, 2026
30 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 426993a6 Deployed Nov 11, 2026 by aakash-saravanan-db via review #1133
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