High-performance async PostgreSQL driver for Python/asyncio. Implements PostgreSQL binary protocol natively — ~5x faster than psycopg3 in benchmarks. Current version: 0.31.0 (Nov 2025). Still pre-1.0. NOT DB-API 2.0 compliant — uses $1/$2 placeholders not %s. No dict row support out of the box — returns Record objects. Major footgun: prepared statements break with pgbouncer in transaction/statement mode (Supabase, Neon poolers).
pip install asyncpgVerified import paths — ran on the pinned version, not inferred.
asyncpg connection pool with correct $1/$2 placeholders.
await conn.fetch('SELECT * FROM t WHERE id = $1 AND active = $2', id, True)Use fetch() for multiple rows, fetchrow() for one row, fetchval() for a single value, execute() for DML without results.
Set statement_cache_size=0 when connecting: await asyncpg.connect('...', statement_cache_size=0). For SQLAlchemy: connect_args={'statement_cache_size': 0}Convert with dict(row) or [dict(r) for r in rows] if you need plain dicts.
Pin version in production: pip install asyncpg==0.31.0
Don't cache prepared statement objects across pool.acquire() calls.
Ensure the PostgreSQL server is running and accessible from the application's host/network. Verify the connection string (host, port) is correct. Check firewall rules.
Ensure the PostgreSQL server is running, listening on the correct host and port, and is reachable from the application's network environment. Verify the database host, port, and any relevant firewall rules.
No dependency data recorded yet.