--- id: pgcopy version: "1.6.2" license: MIT license_treatment: permissive maintenance: aging --- # pgcopy — Fast db insert with postgresql binary copy License: permissive · Maintenance: aging · Downloads: 239.6K/mo ## What it is and what it does pgcopy is a thin wrapper around PostgreSQL's native binary COPY command, exposed through a simple Python API. It lets you load bulk data into PostgreSQL tables orders of magnitude faster than traditional INSERT statements by leveraging the database's optimized binary protocol. The package handles encoding, type conversion, and schema awareness transparently, supporting a wide range of PostgreSQL data types including arrays, JSON, UUIDs, and timestamps with timezone. You instantiate a CopyManager with a psycopg2 connection, table name, and column list, then call copy() with an iterable of tuples or dicts. The package converts your Python data to PostgreSQL's binary format and streams it directly into the table. It's designed for one-shot bulk loads and table replacements rather than streaming or incremental inserts. Use it for: - Migrating large datasets into PostgreSQL from CSV, JSON, or in-memory collections. - Periodic bulk imports of metrics, logs, or sensor data where speed matters more than row-by-row control. - Replacing entire tables atomically with fresh data from an external source. - Loading test fixtures or seed data during application initialization or CI/CD pipelines. - Batch ETL workflows where you stage data in Python and need to land it in Postgres quickly. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. pgcopy wraps PostgreSQL's binary COPY protocol to load data into tables much faster than row-by-row inserts, using psycopg2 as the connection layer. Yes, if you need to load bulk data into PostgreSQL and speed is a priority. The package is stable, has no known vulnerabilities, and carries minimal dependencies. The main caveat is aging maintenance—last release was 264 days ago—so if you hit a bug or need support for a new PostgreSQL feature, responsiveness is uncertain. For one-off bulk loads or established workflows, it's a solid choice; for mission-critical systems requiring active support, verify the maintainer's current availability first. ## Install pip install pgcopy uv add pgcopy poetry add pgcopy ## Installing pgcopy Before you install: Low install friction with a pure-Python wheel and only two runtime dependencies (psycopg2 and pytz). Maintenance status is aging—last release was 264 days ago—but the package is marked Production/Stable and carries no known vulnerabilities. License in practice: MIT license is permissive; you can use, modify, and distribute pgcopy freely in commercial and private projects with minimal restrictions. Quickstart: from pgcopy import CopyManager import psycopg2 conn = psycopg2.connect(database='mydb') mgr = CopyManager(conn, 'my_table', ('col1', 'col2')) mgr.copy([(1, 'a'), (2, 'b')]) conn.commit() Requires an active PostgreSQL database and a valid psycopg2 connection; the target table must already exist. Verify before relying: - Whether the package works with current PostgreSQL versions beyond 9.3 (documentation references 9.3 but classifiers list Python 3.9–3.14). - Current maintenance status and likelihood of future updates or bug fixes given the 264-day release gap. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 239.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgresql bulk insert, fast data loading postgres, binary copy postgresql, bulk load postgres, psycopg2 batch insert, postgresql copy protocol, high-throughput postgres insert, bulk-insert, postgresql, etl [View on SkillFed](https://skillfed.io/packages/pgcopy) · [View on PyPI](https://pypi.org/project/pgcopy/)