Releases: Privex/python-db
Releases · Privex/python-db
0.9.0 - AsyncIO support for wrapper + builder, plus small improvements
Updates and Improvements
- Refactored SqliteWrapper._should_zip into a standalone function for sharing between other classes and methods.
New additions
-
New dependencies:
aiosqlite,async-propertyandnest_asyncio -
New class
db.base.GenericAsyncDBWrapper- an abstract base class for AsyncIO database wrappers -
New class
db.query.asyncx.base.BaseAsyncQueryBuilder- an abstract base class for AsyncIO query builders -
New protocol types in
db.types:GenericAsyncCursor- a protocol which covers any class which implements the Python DB API (PEP 249) for cursors, with all methods being coroutines (async def).GenericAsyncConnection- a protocol which covers any class which implements the Python DB API (PEP 249) for DB connections, with all methods being coroutines (async def).
-
AsyncIO Sqlite3 support:
db.sqlite.SqliteAsyncWrapperusesaiosqliteto provide asynchronous wrapper methods for interacting with Sqlite3 databases asynchronously.db.query.asyncx.sqlite.SqliteAsyncQueryBuilderis a query builder for Sqlite3 which usesaiosqliteto implement async methods for executing the built queries and fetching the results
Unit testing
-
Added
pytest-asyncioas a development dependency, allowing for asynchronous unit tests -
Changes to
tests/base.py:- Created class
_TestAsyncWrapperMixin- an async version of_TestWrapperMixin - Created class
ExampleAsyncWrapper- an async version ofExampleWrapper - Refactored
_TestWrapperMixin.example_usersinto a module variable so that it can be shared by other classes.
- Created class
-
Created
tests/test_async.py- Uses
pytest-asynciofor running async unit test functions - Unit tests to cover the async class
SqliteAsyncWrapper(based on the unit tests intest_sqlite_wrapper.py) - Unit tests to cover the async class
SqliteAsyncQueryBuilder(based on the unit tests intest_sqlite_builder.py)
- Uses
This covers all notable changes and additions. There may possibly be other small changes and improvements too :)