# psycopg/psycopg2

PostgreSQL database adapter for the Python programming language

Repository: https://github.com/psycopg/psycopg2
Canonical: https://ross.abutalabs.com/products/psycopg2
Homepage: https://www.psycopg.org/
Language: C
License: NOASSERTION
License Family: other
Topics: python, postgresql, database, driver
Last push: 2026-05-02T03:03:56+00:00

## Health v2 (maintenance only)
Score: 68/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 80, release rhythm 35, longevity 100
- inputs: {"age_days": 4972, "days_push": 123, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3652, forks 546 (observed 2026-08-28T04:08:13.082518+00:00)

## What it is
Psycopg2 is the most popular PostgreSQL database adapter for Python, implementing the Python DB API 2.0 specification. It is mostly written in C as a libpq wrapper, offering thread safety, server-side and client-side cursors, async notifications, and COPY support.

## Use cases
- connect to postgresql from python
- run sql queries against a postgres database
- bulk load data with COPY FROM
- use postgres from a multi-threaded python application
- execute concurrent inserts and updates
- adapt python types to postgresql data types

## When to choose
- maintaining a legacy application already using psycopg2
- needing a mature, battle-tested DB-API 2.0 driver for PostgreSQL
- supporting very old PostgreSQL versions (7.4+) or older Python versions

## When to avoid
- starting a new Python project (use Psycopg 3 instead)
- needing native asyncio support
- needing prepared statements, pipeline mode, or static typing
- needing a modern connection pool

## Facets
- artifact type: library
- maturity: maintenance
- function: database-driver, database
- domain: databases, backend, developer-tools
- platform: python, cross-platform
- tags: postgresql, db-api-2, libpq, sql, legacy-support

## Member repositories
- psycopg/psycopg2 (main) score 68

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:13.082518+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:31:40.920279+00:00, confidence not recorded.
  - readme: https://github.com/psycopg/psycopg2 (fetched 2026-08-28T04:08:13.082518+00:00, sha 3ab996b6bb9b)
  - homepage: https://www.psycopg.org/ (fetched 2026-08-29T09:25:58.588534+00:00, sha a92bc26b862e)
  - site_page: https://www.psycopg.org/psycopg3/docs/basic/install.html (fetched 2026-08-29T09:25:58.591062+00:00, sha f4f428851775)
  - site_page: https://www.psycopg.org/psycopg3/docs (fetched 2026-08-29T09:25:58.593010+00:00, sha 6a71e6e185d5)
  - site_page: https://www.psycopg.org/docs/install.html (fetched 2026-08-29T09:25:58.594681+00:00, sha 94c1b5bdd8c2)
  - site_page: https://www.psycopg.org/docs (fetched 2026-08-29T09:25:58.596553+00:00, sha ac59e0078aca)
- Data as of 2026-08-30T08:39:29.467469+00:00.
