Repository navigation
Raise DB-API exceptions from Rust (phase 2) - #8
Merged
Merged
Conversation
SQLSTATE table, class promotions and typed native Connection errors now live in src/errors.rs; check_error, raise_exception, sqlstate_to_exception and _raise_connection_error are thin shims. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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.
Moves exception construction into Rust (
src/errors.rs).driver_error/ddbc_error/sqlstate/native_errorattributes are built in Rust; classes are imported once fromarrowsql.exceptions. The "Raising exception" / "Unknown SQLSTATE" / "Connection error" log lines still go through the Python logger.DDBCRaiseFor(handle_type, handle, ret)replaces theDDBCSQLCheckError+ regex round trip.helpers.check_errorcalls it, and falls back to the Python path when a test replacedDDBCSQLCheckError/DDBCSQLGetAllDiagRecords.Connectionandgetinforaise typed exceptions._raise_connection_errorstays as a shim for mocks that raiseRuntimeError("SQLSTATE:..."). Connection close/rollback sites catch(RuntimeError, Error).close()with an open transaction (25000) stays aRuntimeError: upstream'stest_failed_native_disconnect_preserves_child_statementmatches on it.exceptions.sqlstate_to_exception/raise_exceptionare thin shims; the 140-line Python table is gone.Error path (
SELECT * FROM no_such_table, release build): median 184.5us before, 176.5us after; 10k failing executes 1.90s vs 2.02s best of 3. Within noise, the round trip dominates.Tests: common_issues/port/mock pass; upstream baseline 0 missing before the merge of main.
🤖 Generated with Claude Code