{"repo":"klen/aio-databases","free":true,"listed":false,"github":"https://github.com/klen/aio-databases","clone":"git clone https://github.com/klen/aio-databases.git","description":"Async Support for various databases","language":"Python","stars":19,"topics":["asyncio","trio","sql","database"],"license":null,"category":"databases-storage","readme_excerpt":"AIO-Databases The package gives you async support for a range of databases (SQLite, PostgreSQL, MySQL). Features - Has no dependencies (except databases drivers) - Supports asyncio and trio - Supports aiosqlite, aiomysql, aiopg, asyncpg, trio mysql - Manage pools of connections - Manage transactions - Route read queries to replicas with write protection Requirements - python = 3.10 Installation aio-databases should be installed using pip: You have to choose and install the required database drivers with: Usage Init a database Supported schemas - aiomyql - aiomyql+pool - aiopg - aiopg+pool - asyncpg - asyncpg+pool - aioodbc - aioodbc+pool - aiosqlite - trio-mysql Setup a pool of connections (optional) Setup a pool of connections Get a connection If a pool is setup it will be used Run SQL queries - Iterate through rows one by one Manage connections By default the database opens and closes a connection for a query. Manually open and close a connection If there any connection already db.method would be using the current one Reconnect Pass reconnect=True to automatically drop a broken connection and acquire a fresh one: - A failed query is never retried — the error propagates to the caller - The connection is re-acquired immediately after a connection error - Transactions are not restored: a transaction interrupted by a dead connection fails Manage transactions Replicas Configure replicas and route reads through them. Use db.replica() as an async context manager. Inside the block ","default_branch":null,"files":null,"tree":[],"storefront":"/r/klen","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/klen/aio-databases/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}