--- id: aiopg version: "1.4.0" license: BSD license_treatment: permissive maintenance: aging --- # aiopg — Postgres integration with asyncio. License: permissive · Maintenance: aging · Downloads: 634.7K/mo ## What it is and what it does aiopg is an asyncio driver for PostgreSQL that wraps psycopg2's synchronous interface to provide non-blocking database access. It lets you execute queries, manage transactions, and maintain connection pools without blocking the event loop—essential for async web frameworks and concurrent applications that need to query PostgreSQL. The library supports both raw SQL execution via cursors and optional SQLAlchemy integration for ORM-style queries. It handles connection pooling, transaction management, and cursor operations asynchronously. Two runtime dependencies—psycopg2-binary and async-timeout—provide the underlying database driver and timeout handling. Use it for: - Build async web services (FastAPI, aiohttp) that query PostgreSQL without blocking I/O. - Implement concurrent batch processing where multiple coroutines execute database queries in parallel. - Use SQLAlchemy ORM asynchronously by leveraging aiopg.sa for schema-driven database operations. - Manage connection pools efficiently in long-running async applications to avoid resource exhaustion. - Write async database migrations or data pipelines that process large datasets without halting the event loop. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. aiopg provides asyncio-based access to PostgreSQL databases, wrapping psycopg2 to enable non-blocking queries and connection pooling in async Python applications. Yes, with conditions. aiopg is stable and production-ready for async PostgreSQL access, with low install friction and no known vulnerabilities. However, the aging maintenance status (last release October 2022) means it may lag behind recent PostgreSQL or asyncio changes. Install it if you need async PostgreSQL support in an existing codebase or stable async framework; evaluate alternatives if you require cutting-edge PostgreSQL features or are starting a new project where ongoing maintenance is critical. ## Install pip install aiopg uv add aiopg poetry add aiopg ## Installing aiopg Before you install: Low install friction with a pure-wheel distribution. Maintenance status is aging—last release was 2022-10-26 (1388 days ago)—but the repository remains active and unarchived. The package supports current Python versions (3.7–3.11) and has a stable production classifier. License in practice: BSD permissive license places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: import asyncio import aiopg async def query(): pool = await aiopg.create_pool('dbname=mydb user=user password=pass host=localhost') async with pool.acquire() as conn: async with conn.cursor() as cur: await cur.execute('SELECT 1') async for row in cur: print(row) asyncio.run(query()) Requires a running PostgreSQL server and psycopg2-binary (C extension) to be installed; psycopg2-binary must compile or a pre-built wheel must be available for your platform. Verify before relying: - Whether the aging maintenance status (1388 days since last release) affects compatibility with recent PostgreSQL versions or asyncio changes. - Current state of SQLAlchemy integration support given the 1.4.x compatibility fixes in the changelog but no recent releases. ## Package facts - License: BSD (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 634.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async postgres driver, asyncio postgresql client, non-blocking database access, async connection pooling, psycopg2 async wrapper, asyncio database library, async sql execution, async-database, postgres, connection-pooling [View on SkillFed](https://skillfed.io/packages/aiopg) · [View on PyPI](https://pypi.org/project/aiopg/)