psycopg

The most popular PostgreSQL adapter for Python

A complete implementation of the Python DB API 2.0 specification, built on top of the official PostgreSQL client library, with many extensions giving access to the full power of modern Python and PostgreSQL.

sponsors

Psycopg is free software. If you use Python and PostgreSQL and would like to support the maintenance of the most advanced adapter between the two systems, please consider becoming a sponsor. Sponsoring helps ensure the continued maintenance of Psycopg 2, Psycopg 3, and related projects.

See all our sponsors

features

Psycopg 3 is the current generation. It keeps full DB-API 2.0 compatibility while adding native asyncio, server-side binding, pipeline mode, and a much more powerful connection pool.

Psycopg 3 Psycopg 2
Python 3.10–3.14 Python 3.9–3.14
PostgreSQL 10–18 PostgreSQL 7.4–18
Native asyncio support Low-level async only
Server- and client-side parameter binding Client-side binding only
Automatic prepared statements No prepared statements support
Pipeline / batch mode No pipeline mode support
Advanced connection pool Very basic connection pool
Static typing support No static typing support
Async COPY support Synchronous COPY only

Psycopg 3

pip install "psycopg[binary]"

Psycopg 2

pip install psycopg2-binary

development

Note: there is no psycopg3 package - the current generation ships as psycopg. The [binary] extra bundles a pre-compiled C extension so no PostgreSQL client libraries need to be installed separately.

Psycopg 2 remains fully supported for legacy applications. New projects should use Psycopg 3.

Both packages are available on PyPI and install with a single pip command. Source distributions are also available for environments that require compilation from source.

articles

Read more!

maintainers

Daniele Varrazzo

Daniele Varrazzo

Technical Lead

Daniele is the creator and primary maintainer of Psycopg 2 and Psycopg 3. He has been working on PostgreSQL database connectivity for Python for over fifteen years.

His work on the DB-API 2.0 specification, binary protocol support, and asyncio integration has made Psycopg the standard choice for Python developers working with PostgreSQL.

Hannah Maher

Hannah Maher

Operations Lead

Hannah leads day-to-day operations for the Psycopg project and its ecosystem, working closely with the Technical Lead across operational, strategic, and community-focused initiatives.

Her work spans project coordination, release support, issue triage, documentation oversight, and contributor communication, helping the project run smoothly and grow in a fast-moving open-source environment.

Support the project via GitHub Sponsors

contact

Follow the Psycopg team