Fast db insert with postgresql binary copy (fork of pgcopy) without psycopg2 dependency
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pgcopy_standalone-1.6.0.tar.gz
.
File metadata
- Download URL: pgcopy_standalone-1.6.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.1 Linux/5.15.133.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 924c93dbf1c90790990c57edc3bd05774c7ca1af27c72b64c50645de5f13cca1 |
|
MD5 | acc4cb2dcac19219498ff4418b05795e |
|
BLAKE2b-256 | f9357b77e1e332d2b052eb96d75f845354213c61dad3adf437f9ac9b1a0f7e4b |
File details
Details for the file pgcopy_standalone-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: pgcopy_standalone-1.6.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.1 Linux/5.15.133.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3ad719c902de9bf36839af17b58e5d5c5ccc961ea3e056fdb4dac92cc4354cf |
|
MD5 | 5b5ac98a606164d14ab4fd9a11dc1220 |
|
BLAKE2b-256 | bcd9b88c54b9c2045a3a7be3d6c8124f9c03e9cdcafe915c76644cc7a364d9b1 |