5.18.0 — 2026-10-20¶
← 5.18.1 | 5.17.0 → | ↑ 5.x series
Added¶
Models - Errors¶
- Resource Exhausted Error - Added
DatabaseResourceExhaustedErrorfor a database server that runs out of memory or connections.- HTTP status 503 and gRPC status
RESOURCE_EXHAUSTED
- HTTP status 503 and gRPC status
- Unknown Outcome Error - Added
DatabaseUnknownOutcomeErrorfor PostgreSQL40003(statement_completion_unknown), where the statement may or may not have completed. - Retryable Flag - Added the
retryableclass attribute toDatabaseError,Falseby default.TrueonDatabaseSerializationError,DatabaseDeadlockErrorandDatabaseResourceExhaustedError
Changed¶
Adapters - SQLAlchemy¶
- Driver Error Classification - Database errors are now classified by the driver error code before the message text.
- Added
archipy/adapters/base/sqlalchemy/driver_errors.py, used by the adapter mixin and the atomic decorators - Reads PostgreSQL SQLSTATE, MySQL and StarRocks errno, and SQLite error names
- Falls back to
DBAPIError.connection_invalidatedfor a disconnect with no usable code - StarRocks memory-limit errors reported under errno
1064are matched by message, except syntax errors - The message fallback is unchanged for drivers that expose no code
- Added
- Driver Error Logging - The driver code, message, detail, constraint and table are logged once where the domain error is raised.
- Serialization failures, deadlocks and resource exhaustion log at WARNING, everything else at ERROR
- Fields follow the OpenTelemetry names
db.response.status_code,error.typeanddb.query.text - The statement is logged only at DEBUG, with string and numeric literals replaced by
? - Bind parameters are never logged, and no driver detail is added to
additional_data
- Atomic Block Errors - Raw SQLAlchemy errors in the atomic block are classified by code, where every
OperationalErrorused to becomeDatabaseConnectionError.
Models - Errors¶
- Catchable as Query Error -
DatabaseConnectionError,DatabaseTimeoutError,DatabaseConstraintError,DatabaseIntegrityError,DatabaseDeadlockError,DatabaseSerializationError,DatabaseResourceExhaustedErrorandDatabaseUnknownOutcomeErrornow extendDatabaseQueryError.- Existing
except DatabaseQueryErrorblocks keep catching errors that the classification now reports under a specific class - A
DatabaseQueryErrorhandler placed before a more specific handler now shadows it
- Existing
Helpers - Errors¶
- Captured Exception Log -
capture_exceptionnow logs the exception type and message.
Fixed¶
Adapters - SQLAlchemy¶
- Serialization and Deadlock Mapping - A PostgreSQL
40001or40P01raised by an adapter method now maps toDatabaseSerializationErrororDatabaseDeadlockErrorinstead ofDatabaseQueryError.- The mapping in
atomic.pywas never reached for errors raised inside adapter methods - HTTP status changes from 500 to 409 and gRPC status from
INTERNALtoABORTED
- The mapping in
Tests¶
Tests - Models¶
- Database Error Classification - Added
features/database_error_classification.feature.- PostgreSQL, MySQL, StarRocks and SQLite codes, the asyncpg
__cause__case, disconnect flag, handler output and log level DatabaseQueryErrorinheritance, retryable flags and statement sanitizing
- PostgreSQL, MySQL, StarRocks and SQLite codes, the asyncpg