asyncmy2
A fast asyncio MySQL driver
What it is and what it does
asyncmy2 is an async MySQL/MariaDB driver designed for Python 3.10+ that combines the API of aiomysql with a Cython-rewritten protocol layer for faster execution. It supports both simple connections and connection pooling, and includes MySQL replication protocol support for streaming binary log events asynchronously.
The package is a community-maintained fork built on top of pymysql and aiomysql, reusing their design while accelerating the core protocol handling. It has been tested against both MySQL and MariaDB. No runtime dependencies are required beyond Python itself, though installation requires a C++ compiler (pre-installed on Linux/macOS, must be manually set up on Windows).
Use it for:
- Building async web services that need concurrent MySQL queries without blocking I/O
- Streaming MySQL replication events in real-time for data synchronization or analytics pipelines
- Replacing aiomysql when performance is critical and Cython compilation overhead is acceptable
- Connection pooling for high-concurrency applications handling many simultaneous database clients
- Migrating from synchronous pymysql to async code while keeping familiar API patterns
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
asyncmy2 is a fast asyncio-based MySQL/MariaDB driver that rewrites the core protocol in Cython for performance while maintaining API compatibility with aiomysql.
Yes, if you need async MySQL access and are willing to handle Cython compilation. The package is actively maintained, has no known vulnerabilities, and offers API compatibility with aiomysql while claiming performance gains. Install friction is moderate (compilation required, especially on Windows). Not recommended if you need Python versions below 3.10 or want to avoid build toolchain setup.
Install
asyncmy2 on PyPI
pip
pip install asyncmy2uv
uv add asyncmy2poetry
poetry add asyncmy2Installing asyncmy2
Before you install
Medium install friction due to Cython compilation requirements. On Windows, Microsoft C++ Build Tools must be pre-installed. The package is actively maintained with a recent release and no known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions beyond attribution.
Quickstart
import asyncio
from asyncmy import connect
async def main():
conn = await connect(user='root', password='')
async with conn.cursor() as cursor:
await cursor.execute('SELECT 1')
result = await cursor.fetchone()
await conn.ensure_closed()
asyncio.run(main())
Requires Python 3.10+. On Windows, Microsoft C++ Build Tools must be installed before package installation. On macOS/Linux, standard build tools are needed.
Verify before relying
- Whether the Cython performance gains justify the compilation overhead for typical workloads
- Compatibility scope with aiomysql—which specific API surface is covered
- Production readiness given the project's recent creation (first release 2025-10-11)
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 328,516/month — #7,555 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: asyncmy2-0.2.21-cp310-cp310-macosx_10_9_x86_64.whl; asyncmy2-0.2.21-cp310-cp310-macosx_11_0_arm64.whl; asyncmy2-0.2.21-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; asyncmy2-0.2.21-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; asyncmy2-0.2.21-cp310-cp310-musllinux_1_2_aarch64.whl; asyncmy2-0.2.21-cp310-cp310-musllinux_1_2_x86_64.whl; asyncmy2-0.2.21-cp310-cp310-win32.whl; asyncmy2-0.2.21-cp310-cp310-win_amd64.whl; asyncmy2-0.2.21-cp310-cp310-win_arm64.whl; asyncmy2-0.2.21-cp311-cp311-macosx_10_9_x86_64.whl; asyncmy2-0.2.21-cp311-cp311-macosx_11_0_arm64.whl; asyncmy2-0.2.21-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; asyncmy2-0.2.21-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; asyncmy2-0.2.21-cp311-cp311-musllinux_1_2_aarch64.whl; asyncmy2-0.2.21-cp311-cp311-musllinux_1_2_x86_64.whl; asyncmy2-0.2.21-cp311-cp311-win32.whl; asyncmy2-0.2.21-cp311-cp311-win_amd64.whl; asyncmy2-0.2.21-cp311-cp311-win_arm64.whl; asyncmy2-0.2.21-cp312-cp312-macosx_10_13_x86_64.whl; asyncmy2-0.2.21-cp312-cp312-macosx_11_0_arm64.whl
Keywords: driver, asyncio, mysql
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
asyncmyasyncmy is an asyncio-native MySQL/MariaDB…
permissive · top 5,000 on PyPI
PyMySQLPyMySQL is a pure-Python MySQL and MariaDB…
permissive · top 1,000 on PyPI
aiomysqlaiomysql provides async/await access to MySQL…
permissive · top 5,000 on PyPI
hopsworks-aiomysqlAsync MySQL database driver for Python asyncio…
permissive · top 15,000 on PyPI
asynchasynch is an asynchronous ClickHouse driver…
permissive · top 5,000 on PyPI
databasesProvides async database access for PostgreSQL,…
permissive · top 5,000 on PyPI
aiosqlLoad SQL queries from files and call them as…
permissive · top 15,000 on PyPI
pysqlsyncSynchronize database schemas and bulk-load data…
permissive · top 15,000 on PyPI
aioodbcaioodbc provides async/await access to ODBC…
permissive · top 5,000 on PyPI
mysqlclientmysqlclient provides a Python interface to…
copyleft · top 1,000 on PyPI