asmysql v2 Changelog¶
This document records all changes in asmysql v2 version.
v2.0.0¶
Breaking Changes¶
v2.0.0 is a completely refactored version that is incompatible with v1. Main changes include:
- Architecture Refactoring: Separated
EngineandAsMysqlclasses, added independentEngineclass to handle MySQL connections and execute statements - Result Class Changes:
Result.errattribute renamed toResult.error - API Changes: Connection method changed from auto-connect to explicitly creating
Engineand callingconnect()
New Features¶
- Engine Class: Brand new connection engine class with URL connection string support, connection status monitoring, and flexible connection management
- Result Class Enhancements: Support for error information access (
error_no,error_msg), streaming queries, context managers, async iterators, and custom result types - Execution Method Enhancements:
execute()method supportsstream,result_class,commitparameters and multiple calling methods - Type Hints: Complete type hint support with generic types (
Result[T]) - Testing: New pytest test suite covering main functional scenarios
Updates¶
- Package Management Tool: Using
uvas package management tool - Code Quality: Improved code structure, error handling, and docstrings
Core Features¶
v2 version retains the core features of v1:
- Easy to Use: asmysql is an easy-to-use library that wraps aiomysql
- Connection Pool Management: Automatic MySQL connection pool management with reconnection mechanism
- Error Handling: Global automatic capture of
MysqlErrorerrors - Separation of Execution and Retrieval: Separation of SQL statement execution and result retrieval
- Type Hints: Complete Python type hint support
- Business Logic Development: Directly inherit
AsMysqlclass for logic development
Migration Guide¶
For detailed migration guide, please refer to Migration Guide.