asyncpg
An asyncio PostgreSQL driver
Install
asyncpg on PyPI
pip
pip install asyncpguv
uv add asyncpgpoetry
poetry add asyncpgPackage facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9.0) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — async_timeout |
| Maintenance | actively maintained — 262 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: asyncpg-0.31.0-cp310-cp310-macosx_10_9_x86_64.whl; asyncpg-0.31.0-cp310-cp310-macosx_11_0_arm64.whl; asyncpg-0.31.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; asyncpg-0.31.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; asyncpg-0.31.0-cp310-cp310-musllinux_1_2_aarch64.whl; asyncpg-0.31.0-cp310-cp310-musllinux_1_2_x86_64.whl; asyncpg-0.31.0-cp310-cp310-win32.whl; asyncpg-0.31.0-cp310-cp310-win_amd64.whl; asyncpg-0.31.0-cp311-cp311-macosx_10_9_x86_64.whl; asyncpg-0.31.0-cp311-cp311-macosx_11_0_arm64.whl; asyncpg-0.31.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; asyncpg-0.31.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; asyncpg-0.31.0-cp311-cp311-musllinux_1_2_aarch64.whl; asyncpg-0.31.0-cp311-cp311-musllinux_1_2_x86_64.whl; asyncpg-0.31.0-cp311-cp311-win32.whl; asyncpg-0.31.0-cp311-cp311-win_amd64.whl; asyncpg-0.31.0-cp312-cp312-macosx_10_13_x86_64.whl; asyncpg-0.31.0-cp312-cp312-macosx_11_0_arm64.whl; asyncpg-0.31.0-cp312-cp312-manylinux_2_28_aarch64.whl; asyncpg-0.31.0-cp312-cp312-manylinux_2_28_x86_64.whl
Keywords: database, postgres
About asyncpg
from the package's own PyPI description — quoted content, verbatim
asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio
.. image:: https://github.com/MagicStack/asyncpg/workflows/Tests/badge.svg :target: https://github.com/MagicStack/asyncpg/actions?query=workflow%3ATests+branch%3Amaster :alt: GitHub Actions status .. image:: https://img.shields.io/pypi/v/asyncpg.svg :target: https://pypi.python.org/pypi/asyncpg
asyncpg is a database interface library designed specifically for
PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation
of PostgreSQL server binary protocol for use with Python's asyncio
framework. You can read more about asyncpg in an introductory
blog post <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>_.
asyncpg requires Python 3.9 or later and is supported for PostgreSQL versions 9.5 to 18. Other PostgreSQL versions or other databases implementing the PostgreSQL protocol may work, but are not being actively tested.
Documentation
The project documentation can be found
here <https://magicstack.github.io/asyncpg/current/>_.
Performance
In our...
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
asyncpg is a high-performance async PostgreSQL driver for Python that implements the PostgreSQL protocol natively to enable efficient database queries within asyncio applications.
Medium install friction due to compiled C extensions across multiple platforms (wheels provided for CPython 3.9–3.14 on macOS, Linux, and Windows). Active maintenance with recent releases and 8062 GitHub stars indicate solid community support.
Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most production environments.
Usage
pip install asyncpg
import asyncio
import asyncpg
async def run():
conn = await asyncpg.connect(user='user', password='password',
database='database', host='127.0.0.1')
values = await conn.fetch('SELECT * FROM mytable WHERE id = $1', 10)
await conn.close()
asyncio.run(run())
Requires Python 3.9 or later and a running PostgreSQL 9.5+ server; GSSAPI/SSPI authentication requires optional 'gssauth' extra.
Verdict: asyncpg is a mature, actively maintained async PostgreSQL driver (Apache-2.0 licensed, no known vulnerabilities) with strong performance claims and broad Python version support. Medium install friction from compiled extensions is typical for performance-critical database drivers and well-mitigated by pre-built wheels.
Needs verification
- Whether the claimed 5x performance advantage over psycopg3 holds across typical application workloads and query patterns.
- Support status and testing coverage for PostgreSQL versions 17–18 mentioned in description.
Similar packages
permissive · top 1,000 on PyPI
pyspnegopermissive · top 1,000 on PyPI
pg8000permissive · top 1,000 on PyPI
httptoolspermissive · top 1,000 on PyPI
psycopgcopyleft · top 1,000 on PyPI
psycopg2copyleft · top 1,000 on PyPI
psycopg2-binarycopyleft · top 1,000 on PyPI
Send2Trashpermissive · top 1,000 on PyPI
pymongopermissive · top 1,000 on PyPI
uvlooppermissive · top 1,000 on PyPI