--- id: psycopg2 version: "2.9.12" license: LGPL with exceptions license_treatment: copyleft maintenance: active --- # psycopg2 — psycopg2 - Python-PostgreSQL Database Adapter License: copyleft · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install psycopg2 uv add psycopg2 poetry add psycopg2 ## Description Psycopg is the most popular PostgreSQL database adapter for the Python programming language. Its main features are the complete implementation of the Python DB API 2.0 specification and the thread safety (several threads can share the same connection). It was designed for heavily multi-threaded applications that create and destroy lots of cursors and make a large number of concurrent "INSERT"s or "UPDATE"s. Psycopg 2 is mostly implemented in C as a libpq wrapper, resulting in being both efficient and secure. It features client-side and server-side cursors, asynchronous communication and notifications, "COPY TO/COPY FROM" support. Many Python types are supported out-of-the-box and adapted to matching PostgreSQL data types; adaptation can be extended and customized thanks to a flexible objects adaptation system. Psycopg 2 is both Unicode and Python 3 friendly. .. Note:: The psycopg2 package is still widely used and actively maintained, but it is not expected to receive new features. `Psycopg 3`__ is the evolution of psycopg2 and is where `new features are being developed`__: if you are starting a new project you should probably... ## AI interpretation — verify before relying PostgreSQL database adapter implementing the Python DB API 2.0 specification, with thread-safe connections, client and server-side cursors, and asynchronous communication support. Verdict: Psycopg2 is a mature, production-grade PostgreSQL adapter in the top 1000 PyPI packages with no known vulnerabilities and active maintenance. Medium install friction is offset by prebuilt wheels and the option of psycopg2-binary. LGPL copyleft licensing requires review for proprietary use. The package is stable but feature-frozen; new projects should consider Psycopg 3. [View on SkillFed](https://skillfed.io/packages/psycopg2) · [View on PyPI](https://pypi.org/project/psycopg2/)