Use pgcopy for fast data loading into PostgreSQL with binary copy.
Features
Support for many data types
Support for multi-dimensional array types
Support for schema and schema search path
Support for mixed-case table and column names
Transparent string encoding
Utility for replacing entire table
Quickstart
from datetime import datetime
from pgcopy import CopyManager
import psycopg2
cols = ('id', 'timestamp', 'location', 'temperature')
now = datetime.now()
records = [
(0, now, 'Jerusalem', 72.2),
(1, now, 'New York', 75.6),
(2, now, 'Moscow', 54.3),
]
conn = psycopg2.connect(database='weather_db')
mgr = CopyManager(conn, 'measurements_table', cols)
mgr.copy(records)
# don't forget to commit!
conn.commit()
Supported datatypes
pgcopy supports the following PostgreSQL scalar types:
bool
smallint
integer
bigint
real
double precision
char
varchar
text
bytea
enum types
date
time
timestamp
timestamp with time zone
numeric
json
jsonb
uuid
arrays
vector
Documentation
Metadata
Release files for pgcopy 1.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pgcopy-1.6.2.tar.gz | 19.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgcopy-1.6.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / pgcopy-1.6.2.tar.gz
| Download URL | pgcopy-1.6.2.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07192bcbfb8655c516cbd070e849c4888b981343de6b385b477ff79d5b8ec914
|
|
BLAKE2b-256 checksum How to use checksums |
2ed6e88e317a58a981c5f3a06c5d440eb1ae1c20ddbdf1076963ce8221801661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / pgcopy-1.6.2-py2.py3-none-any.whl
| Download URL | pgcopy-1.6.2-py2.py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8ed6dbb54d0e0daa7edd5a0646ec4460191a8c41b434b49c377ff32031e259de
|
|
BLAKE2b-256 checksum How to use checksums |
a750af19f2e187c612a7a9db9ffba080d1337d3f260d7c783766214cc9349990
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|