pgcopy
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
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
Documentation
See Also
cpgcopy, a Cython implementation, about twice as fast.
Metadata
Release files for pgcopy-standalone 1.6.0
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_standalone-1.6.0.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgcopy_standalone-1.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.1 kB
Release files / pgcopy_standalone-1.6.0.tar.gz
| Download URL | pgcopy_standalone-1.6.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
924c93dbf1c90790990c57edc3bd05774c7ca1af27c72b64c50645de5f13cca1
|
|
BLAKE2b-256 checksum How to use checksums |
f9357b77e1e332d2b052eb96d75f845354213c61dad3adf437f9ac9b1a0f7e4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.1 Linux/5.15.133.1-microsoft-standard-WSL2
|
Release files / pgcopy_standalone-1.6.0-py3-none-any.whl
| Download URL | pgcopy_standalone-1.6.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3ad719c902de9bf36839af17b58e5d5c5ccc961ea3e056fdb4dac92cc4354cf
|
|
BLAKE2b-256 checksum How to use checksums |
bcd9b88c54b9c2045a3a7be3d6c8124f9c03e9cdcafe915c76644cc7a364d9b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.1 Linux/5.15.133.1-microsoft-standard-WSL2
|