python-aiomysql

Installation
SKILL.md

aiomysql — Async MySQL for Python

aiomysql provides asyncio-native access to MySQL databases. It wraps PyMySQL with async/await support and exposes Connection, Cursor, and Pool primitives that mirror the synchronous DBAPI interface.

Requirements: Python 3.9+, PyMySQL. Install with:

pip install aiomysql
# Optional SQLAlchemy expression layer:
pip install aiomysql sqlalchemy

Core Principles

  • Always use a connection pool (create_pool) in production — never bare connect() for long-lived services.
  • Always use async context managers (async with) to guarantee connection and cursor release.
  • Never format SQL strings manually. Always pass parameters as the second argument to execute().
  • Commit explicitly; autocommit defaults to False.
  • Close the pool cleanly on shutdown: pool.close() then await pool.wait_closed().
Related skills
Installs
3
GitHub Stars
10
First Seen
Mar 15, 2026