Repository navigation
feat(pyo3): async statement (submit / status / await_result / fetch_result) - #15
Closed
vikrantpuppala wants to merge 1 commit into
Closed
vikrantpuppala wants to merge 1 commit into
vikrantpuppala wants to merge 1 commit into
Conversation
…esult) Phase 1 step 4. Wraps the kernel's `ExecutedAsyncStatement` so the connector can run `cursor.execute(async_op=True)` workflows through the kernel: submit returns immediately with a `statement_id`, the caller polls `status()` and pulls results via `await_result()` or `fetch_result()` once a terminal state is reached. New Python surface: - `Statement.submit() -> ExecutedAsyncStatement` - `ExecutedAsyncStatement.statement_id` - `ExecutedAsyncStatement.status() -> (state: str, failure: Optional[dict])` Returns one of `Pending / Running / Succeeded / Failed / Cancelled / Closed`. `failure` is populated only for `Failed` and carries the same structured-attrs dict that `KernelError` exposes (code, sql_state, error_code, query_id, etc.). Surfacing failure as a dict rather than raising lets polling callers branch without a try/except boundary. - `ExecutedAsyncStatement.await_result() -> ResultStream` — blocks with kernel-managed poll cadence, raises on `Failed` / `Cancelled`. - `ExecutedAsyncStatement.fetch_result() -> ResultStream` — fetches without polling; raises `KernelError(code='InvalidState')` if the statement is still running. - `ExecutedAsyncStatement.cancel() / close()` — same semantics as the sync handle's counterparts. Smoke test (`pyo3/smoke.py`) extended with the async surface; all checks pass against dogfood. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
6 tasks done
Collaborator
Author
|
Collapsed into #13 — that PR now carries all four Phase 1 commits (scaffold, metadata, async, external auth) as a single review. Closing this one to consolidate the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Surface added
`state` is one of `Pending / Running / Succeeded / Failed / Cancelled / Closed`. For `Failed`, `failure` carries the same structured-attrs dict `KernelError` exposes (`code`, `message`, `sql_state`, `error_code`, `vendor_code`, `http_status`, `retryable`, `query_id`). Returning the dict rather than raising lets polling callers branch without a try/except boundary; the connector backend re-raises to PEP 249 exceptions when it actually needs to.
Test plan
This pull request and its description were written by Isaac.