I see references to both psycopg2 and psycopg3, but no clear guidance wrt a roadmap for transitioning between the two. I see that over time there is a large body of SO questions regarding psycopg2.
Is psycopg3 intended to be a replacement for psycopg2? Has there been a significant uptake of this version?
Will there be a long-lived version of psycopg2? Are there any compelling reasons to choose one version over the other?
From the documentation of psycopg3:
Psycopg 3 is a newly designed PostgreSQL database adapter for the Python programming language.
Psycopg 3 presents a familiar interface for everyone who has used Psycopg 2 or any other DB-API 2.0 database adapter, but allows to use more modern PostgreSQL and Python features, such as:
- Asynchronous support
- COPY support from Python objects
- A redesigned connection pool
- Support for static typing
- Server-side parameters binding
- Prepared statements
- Statements pipeline
- Binary communication
- Direct access to the libpq functionalities
From a glance, psycopg3 appears to support more modern python and postgresql features like typing and async. Doing so likely required a lot of backwards-incompatible changes from psycopg2, hence the new version and forked development.