On this page
Overview
Psycopg 3 is a PostgreSQL adapter for Python. It provides synchronous and asynchronous connections, cursors, transactions, and PostgreSQL type adaptation, with a pure-Python implementation plus optional binary and C implementations. Connection pooling is distributed separately.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Use synchronous and asynchronous PostgreSQL connections with parallel API concepts
psycopg.connect() provides synchronous connections while AsyncConnection.connect() supports asynchronous applications. Context managers manage commit or rollback behavior and connection closure, and the project also documents gevent integration.
Choose pure Python, binary, or C implementations and add pooling separately
The main package includes a pure-Python implementation, the binary extra installs a prebuilt implementation, and the c extra adds the C extension. Connection pools live in the separate psycopg-pool package with synchronous and asynchronous lifecycle management.
Best fit
Fits Python backends that want explicit PostgreSQL driver and transaction control
Psycopg can sit underneath an ORM or be used directly by SQL-oriented services. It fits synchronous web applications, asynchronous services, and batch workloads that need explicit control over PostgreSQL connections and transactions.
Before adoption
Psycopg 3.3.6 requires Python 3.10+; verify implementation and libpq requirements per deployment
Psycopg 3.3.6 requires Python 3.10 or newer. The pure-Python, binary, and C installation modes have different libpq and build characteristics. Version 3.3.6 adds Python 3.15 support, reduces async query overhead, and avoids indefinite waits after query interruption; part of the interrupt fix requires libpq 17 or newer.
Official sources
- [1]psycopg/psycopg — GitHub repository(2026-10-06)
- [2]Psycopg 3.3.6 — README(2026-10-06)
- [3]Psycopg 3.3.6 — package metadata(2026-10-06)
- [4]Psycopg 3.3.6 — basic usage(2026-10-06)
- [5]Psycopg 3.3.6 — concurrent operations(2026-10-06)
- [6]Psycopg 3.3.6 — connection pools(2026-10-06)
- [7]Psycopg 3.3.6 release notes(2026-10-06)
- [8]Psycopg LGPL-3.0-only license(2026-10-06)
Supplemental curator note
Psycopg exposes the PostgreSQL driver layer directly, making it useful when transactions, connections, and type adaptation should not be hidden behind an ORM. Choose pure Python, binary, or C installation and whether pooling belongs in the application or an external pooler per deployment.
Try it in 3 steps
- 1
Install the Psycopg 3.3.6 binary implementation
Pin the reviewed Psycopg release. Python 3.10 or newer is required.
python -m pip install "psycopg[binary]==3.3.6" - 2
Set a disposable PostgreSQL connection string
Replace USER, PASSWORD, HOST, and DBNAME with a PostgreSQL database that is safe to use for verification. Do not commit real credentials.
export DATABASE_URL='postgresql://USER:PASSWORD@HOST:5432/DBNAME' - 3
Connect and read the server version
Use a read-only SELECT to verify connectivity and query execution without changing database schema or data.
python - <<'PY' import os import psycopg with psycopg.connect(os.environ['DATABASE_URL']) as conn: print(conn.execute('select version()').fetchone()[0]) PY
Growth
Growth trends · Last 30 days
2,504 Stars
Trend data is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- database
- development
- driver
- postgresql
- python
- Stars
- 2,504
- Forks
- 283
- Watchers
- 28
- Open issues
- 64
- Contributors
- 103
- Owner type
- Organization
- Primary language
- Python
- License
- LGPL-3.0-only
- Repository last updated
- Oct 2, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- sqlx17,743 Stars
3 shared tag(s) · 2 shared category(s)
extend database/sql with struct scanning and named queries without replacing its interfaces
Go - Ent17,204 Stars
3 shared tag(s) · 2 shared category(s)
generate statically typed query APIs from Go schemas with an entity framework
Go - Go MySQL Driver15,278 Stars
3 shared tag(s) · 2 shared category(s)
connect standard database/sql applications to MySQL and MariaDB with a pure-Go driver
Go - Diesel14,193 Stars
3 shared tag(s) · 2 shared category(s)
validate SQL queries and schemas with Rust's type system through an ORM and query builder
Rust - SeaORM9,914 Stars
3 shared tag(s) · 2 shared category(s)
manage asynchronous queries, relations, and migrations with a relational ORM for Rust
Rust - Bun4,984 Stars
3 shared tag(s) · 2 shared category(s)
add SQL-first query building and model mapping to Go's database/sql layer
Go
Report incorrect information
Tell us if any listing information is incorrect or outdated.