qmetrics.net

psycopg2

PostgreSQL database adapter for Python

DatabasesDesktop/CLI app
psycopg2 screenshot

Psycopg2 is a widely used PostgreSQL driver for Python implementing DB API 2.0. It wraps libpq for efficient threaded access, cursors, COPY, and async notifications.

Overview

Psycopg2 connects Python applications to PostgreSQL using a C extension built on libpq. It implements the Python DB API 2.0 specification and is designed for multi-threaded programs that create many cursors and concurrent inserts or updates while sharing connections safely.

The driver supports client-side and server-side cursors, asynchronous communication, listeners for notifications, and COPY TO and COPY FROM workflows. Many Python types map to native PostgreSQL types out of the box, and the adaptation system can be extended for custom types. Unicode and Python 3 are supported in the maintained 2.x line.

Installation is typically via pip as psycopg2 or the prebuilt psycopg2-binary wheel for development and testing; production guidance favors building from source when compilers and libraries are available. Documentation ships with the project and online. The maintainers note that new features land in Psycopg 3 while psycopg2 remains actively maintained for existing codebases.

Applications import psycopg2, open connections with standard parameters, run SQL through cursors, and manage transactions explicitly. It is a client library, not a database server, and pairs with any PostgreSQL deployment you already host.

Key features

  • Python DB API 2.0 implementation
  • Thread-safe shared connections
  • Client- and server-side cursors
  • Asynchronous communication support
  • PostgreSQL NOTIFY listening
  • COPY TO and COPY FROM support
  • Built-in Python to SQL type adaptation
  • Unicode and Python 3 compatibility

Use cases

  • Python web apps talking to PostgreSQL
  • ETL scripts using COPY bulk load
  • Long-running services with threaded workers
  • Listening for database NOTIFY events
  • Legacy projects staying on psycopg2

Tags

Similar software

Supabase

Open-source Postgres platform with auth, APIs, and storage

Supabase bundles a dedicated Postgres database with authentication, auto-generated REST and GraphQL APIs, realtime, functions, file storage, and vector tooling.

★ 115.6k⟳ todayApache-2.0
Open Source Alternative to:FirebaseFirebase Realtime Database

Prometheus

Open-source metrics monitoring and time series database

Prometheus collects metrics from configured targets, evaluates rules, and can raise alerts. It stores time series data and exposes a query language called PromQL.

★ 67.9k⟳ yesterdayApache-2.0
Open Source Alternative to:PRTG Network Monitor

NocoDB

Self-hostable no-code database with spreadsheet interface

NocoDB turns Postgres, MySQL, SQLite, or a hosted database into editable tables with grid, kanban, form, gallery, and calendar views. Teams collaborate with roles, sharing, REST APIs, and workflow integrations.

★ 65.6k⟳ todaySource-available
DatabasesSelf-hostable

etcd

Raft-backed distributed consistent key-value store

etcd stores small critical configuration and coordination data for clusters. It exposes a gRPC API, tolerates failures via Raft, and ships with the etcdctl command-line client.

★ 52.7k⟳ 3 days agoApache-2.0
DatabasesSelf-hostable

DBeaver

Universal multi-platform database tool and SQL client

Free desktop client for developers and DBAs with SQL editing, data editing, ER diagrams, exports, and support for hundreds of JDBC or ODBC databases.

★ 52.6k⟳ todayApache-2.0
DatabasesDesktop/CLI app
Open Source Alternative to:DataGripNavicat+2

ClickHouse

Column-oriented real-time analytics database management system

ClickHouse is a column-oriented database for generating analytical reports in real time using SQL on large datasets.

★ 51.2k⟳ todayApache-2.0
Open Source Alternative to:Amazon Redshift