Registry / database / asyncmy2

asyncmy2

JSON →
library0.2.20pypypi✓ verified 83d ago

A fast asyncio MySQL driver with native Python coroutines and automatic connection pooling. Version 0.2.20, requires Python >=3.10, actively maintained.

pip install asyncmy2
INSTALL
IMPORT
SIG · ASYNCMY2
A
asyncmy2
databasepythonv0.2.20
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connect
from asyncmy import connect
from asyncmy2 import connect
Connection
from asyncmy import Connection
from asyncmy2 import Connection
create_pool
from asyncmy import create_pool
from asyncmy2 import create_pool

Connect to MySQL and run a simple query.

import asyncio from asyncmy2 import connect async def main(): conn = await connect(host='127.0.0.1', port=3306, user='user', password='pass', db='test') async with conn.cursor() as cur: await cur.execute("SELECT 1") result = await cur.fetchone() print(result) await conn.ensure_closed() asyncio.run(main())
Debug
Known issues
breakingasyncmy2 is not a drop-in replacement for asyncmy. The import paths and API differ. Do not mix asyncmy2 with asyncmy in the same project.
fix
Use consistent imports from asyncmy2 only.
affects: all
gotchaConnections must be explicitly closed with `await conn.ensure_closed()`. Not doing so can leak connections, especially if using connection pools.
fix
Always call `await conn.ensure_closed()` after use, or use context managers if available.
affects: all
gotchaThe `Pool` class is not re-entrant. You cannot create a pool inside an already running event loop without proper shutdown. Use `await pool.close()` before the loop ends.
fix
Ensure `await pool.close()` is called during cleanup.
affects: all
Upgrade
Version history
0.2.20latest on PyPI · released Dec 18, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
asyncmy2 — pip install asyncmy2 · libregistry