Alternative approach to database API with full native async support and connection pool.
Project description
gcm-asyncdb
This library provides better, more robust database API with strong enforcement of transaction logic when working with relational databases.
Currently, only MySQL (aiomysql) is supported, but support for other databases should be easy to implement, when required.
Documentation
API documentation is available at https://asyncdb.gcm.cz/
Installation
pip install gcm-asyncdb
Usage
from asyncdb.aiomysql import TransactionFactory, MySQLConfig
db = TransactionFactory(MySQLConfig(
host='localhost',
user='root',
database='test'
))
async def main():
async with db.transaction() as t:
await t.query('CREATE TABLE test (id INT PRIMARY KEY, name VARCHAR(255))')
await t.query('INSERT INTO test (id, name) VALUES (1, "test")')
result = await t.query('SELECT * FROM test')
async for row in result.fetch_all_dict():
print(row)
await t.commit()
License
MIT
Maturity
This library is still very new, but grew from multiple projects where it gradually evolved. So it is already used in production, but it is still recommended to test it thoroughly before using it in production.
Historically, there has been problems with losing connections from connection pool in rare unpredictable error cases, it seems to be resolved now, but there is no regression test for this, so be careful.
Contributing
Feel free to open an issue or a pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gcm_asyncdb-2.1.7.tar.gz.
File metadata
- Download URL: gcm_asyncdb-2.1.7.tar.gz
- Upload date:
- Size: 41.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/5.15.0-134-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b033b3862407fe6828883024b4b2634aa72d09ae31f45117c9323366f3cebfc
|
|
| MD5 |
39d2a8301a6123ac4bbe0dfdca612c91
|
|
| BLAKE2b-256 |
f17c7aca46151e385e22dcb0c145907c9ef5ec948a8856e8f67c5e4f769afeb5
|
File details
Details for the file gcm_asyncdb-2.1.7-py3-none-any.whl.
File metadata
- Download URL: gcm_asyncdb-2.1.7-py3-none-any.whl
- Upload date:
- Size: 49.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/5.15.0-134-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d58f88b2e0a79bf0bbac4b4784b83ae78a88fffc16d7938c08fe6de8b797984
|
|
| MD5 |
1fd5557e56ab19c4158b2e53fabc95c7
|
|
| BLAKE2b-256 |
ca1101bf9e84913fa85d937caba30e841898b6438b62812c5522e20fe7b993c6
|