PGPackDumper
Library for read and write PGPack format between PostgreSQL and file
Examples
Initialization
from pgpack_dumper import (
CompressionMethod,
PGConnector,
PGPackDumper,
)
connector = PGConnector(
host = <your host>,
dbname = <your database>,
user = <your username>,
password = <your password>,
port = <your port>,
)
dumper = PGPackDumper(
connector=connector,
compression_method=CompressionMethod.ZSTD, # or CompressionMethod.LZ4 or CompressionMethod.NONE
)
Read dump from PostgreSQL into file
file_name = "test_table.pgpack"
# you need define one of parameter query or table_name
query = "select ..." # some sql query
table_name = "public.test_table" # or some table
with open(file_name, "wb") as fileobj:
dumper.read_dump(
fileobj,
query,
table_name,
)
Write dump from file into PostgreSQL
file_name = "test_table.pgpack"
# you need define one of parameter table_name
table_name = "public.test_table" # some table
with open(file_name, "rb") as fileobj:
dumper.write_dump(
fileobj,
table_name,
)
Write from PostgreSQL into PostgreSQL
Same server
table_dest = "public.test_table_write" # some table for write
table_src = "public.test_table_read" # some table for read
query_src = "select ..." # or some sql query for read
dumper.write_between(
table_dest,
table_src,
query_src,
)
Different servers
connector_src = PGConnector(
host = <host src>,
dbname = <database src>,
user = <username src>,
password = <password src>,
port = <port src>,
)
dumper_src = PGPackDumper(connector=connector_src)
table_dest = "public.test_table_write" # some table for write
table_src = "public.test_table_read" # some table for read
query_src = "select ..." # or some sql query for read
dumper.write_between(
table_dest,
table_src,
query_src,
dumper_src,
)
Get stream object
# you need define one of parameter query or table_name
query = "select ..." # some sql query
table_name = "public.test_table" # or some table
reader = dumper.to_reader(query=query, table_name=table_name)
print(reader)
# <PostgreSQL/GreenPlum stream reader>
# ┌─────────────────┬─────────────────┐
# │ Column Name │ PostgreSQL Type │
# ╞═════════════════╪═════════════════╡
# │ column1 │ date │
# │-----------------+-----------------│
# │ column2 │ bpchar │
# │-----------------+-----------------│
# │ column3 │ bpchar │
# └─────────────────┴─────────────────┘
# Total columns: 3
# Readed rows: 0
StreamReader has three methods available, but only one of the methods is available at a time within a single session.
# read as python generator object
reader.to_rows()
# or read as pandas.DataFrame
reader.to_pandas()
# or read as polars.DataFrame
reader.to_polars()
Write from python objects into target table
# some table for write data
table_name = "public.test_table"
dtype_data: Itarable[Any]
pandas_frame: pandas.DataFrame
polars_frame: polars.DataFrame
# write from python object
dumper.from_rows(dtype_data, table_name)
# write from pandas.DataFrame
dumper.from_pandas(pandas_frame, table_name)
# write from polars.DataFrame
dumper.from_polars(polars_frame, table_name)
Open PGPack file format
Get info from my another repository https://github.com/0xMihalich/pgpack
Installation
From pip
pip install pgpack-dumper
From local directory
pip install .
From git
pip install git+https://github.com/0xMihalich/pgpack_dumper
Metadata
Release files for pgpack-dumper 0.3.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 1.9 MB
Release files / pgpack_dumper-0.3.5.4-cp314-cp314-win_amd64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 51.3 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
06a00bb1bcf72f974e41a8d20da09fefe23f11dd7cd30b23a945a16931c2e056
|
|
BLAKE2b-256 checksum How to use checksums |
5cccb1708ccd265471ed1602d2b12928d8de5a1eb89b6c332fcd2b951a73d60b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 218.2 kB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
00e90b979cf89a9f4285a36ec380b11e6afd414d7592196e61aa956b73f80424
|
|
BLAKE2b-256 checksum How to use checksums |
35dd3f5ecaffc840f519005ec417783877bc17384d344c18acd5af3c54a2ad50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 53.6 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6a82855b3ffc2a0b9595976dad7d6a94de4de6bc9b4cc6edba12967cc81c6632
|
|
BLAKE2b-256 checksum How to use checksums |
1ba3fc3b3a485ff02ef0c36c901a403bc2368d434a925296b1cabb24e92abe85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp314-cp314-macosx_10_15_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp314-cp314-macosx_10_15_x86_64.whl |
|---|---|
| Size | 52.8 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
9e0dfc6abe587756e1af553b5e9fa7c409e426ad9556d03ebebb39f3ff591d3f
|
|
BLAKE2b-256 checksum How to use checksums |
de6446975399cdc2b185c365fed9e1081f8098ce37807b1163f9ac534836c402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp313-cp313-win_amd64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 50.5 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c0de6fcc8a7729ff27dc037a5e276de09f59cd65fae61a54707a34fa8dc5929d
|
|
BLAKE2b-256 checksum How to use checksums |
942c086f0ea22b993187d7fcccab89eca35abf4f1202c351745a38fab82f2de0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 219.8 kB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e13d1d83dee550a52bbe37a6ec9d4f9da60b7d56cf1cfdf93db82d7ea32509b8
|
|
BLAKE2b-256 checksum How to use checksums |
461e2844d2085f83b66c3dd269200a33fec4a234474b672db0b8be7e5d931b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 53.2 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
935bc58c3e337edf6e10ca239bd872a06ea72160830d2301d3c49168974c938f
|
|
BLAKE2b-256 checksum How to use checksums |
41dbcc7aaa0c8757d6e73a3411c904d5ad6f2544a9894686efd9c98863f2497a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp313-cp313-macosx_10_14_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp313-cp313-macosx_10_14_x86_64.whl |
|---|---|
| Size | 52.6 kB |
| Tags | CPython 3.13 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
bc5b8b2a17391cfb712b4535b518d965ff1a85131698c1626e6d25afb1dffa5e
|
|
BLAKE2b-256 checksum How to use checksums |
2149edf293269d1d3916f3c4ce7058827f79139c4d313e5684231f1161475704
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp312-cp312-win_amd64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 50.7 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d417a65ba76d4ac482b7e9180c22f230be39b410ab93e20d00a5a988a2c30afe
|
|
BLAKE2b-256 checksum How to use checksums |
1257b41e1ba8ba22f6fe1222fe548076642c1c223315159f2f8944c552c58f0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 232.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1fb73b410afb411e3a0bc201bb5a924a74cdfe5ee403d9b830a49cfa553cc67
|
|
BLAKE2b-256 checksum How to use checksums |
2a4c221aa36dfb2022f3bb15de64c297ed90ecb5203956c1c7d7fa289e648084
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 53.8 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c09aab2fe28bfef1e7174a5d0e0443ccaecf200d9c81c58a527387243bdc994d
|
|
BLAKE2b-256 checksum How to use checksums |
ad6d7a01b0f438133442d8fb007708081ba75a31fb9d70e1dbc049b3fce8b4bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp312-cp312-macosx_10_14_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp312-cp312-macosx_10_14_x86_64.whl |
|---|---|
| Size | 53.1 kB |
| Tags | CPython 3.12 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
0cb8bc9a07e36200166f38945ef910b8b696e1549f29c1efa3e8e295a54adf2b
|
|
BLAKE2b-256 checksum How to use checksums |
8e63bf266f706b3e44968e35483c3ff6da02a61e8d18f39b87cd0e5571028579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp311-cp311-win_amd64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 50.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ae2b0d2305952130bdedd18e75022c163b62c1cee9488d163e9fb00ddd07a641
|
|
BLAKE2b-256 checksum How to use checksums |
a9da4c792890b721bef00590e9f80aac1b4e1194a08c368436e42840bff9a740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 223.1 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
0d0559ae8bb5979086141cc91fb472b1bb1942e8e0c9ecc917d92f1985fc7c1a
|
|
BLAKE2b-256 checksum How to use checksums |
3c6eea77e58b7488d922d50144faef30649ef3d1fbd060879b63a6a5237304fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 54.3 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3171eb008ca11c51f1bcfd94c79b070801c53e776506dac40d1804226453980f
|
|
BLAKE2b-256 checksum How to use checksums |
143dfce3c43fa6c2a11044fb6347d47c3770eb7680511174900f8ece7d6eaa43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp311-cp311-macosx_10_14_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp311-cp311-macosx_10_14_x86_64.whl |
|---|---|
| Size | 53.2 kB |
| Tags | CPython 3.11 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
c5bb5c9d5128696fc5f608f458f8610cc0a31421f6048f0d52e3031b2a46257f
|
|
BLAKE2b-256 checksum How to use checksums |
bdbc58eccb1674b2f0e2e3fe57796b3a245dbea4fd27ccfd0ea406f22a01c4a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp310-cp310-win_amd64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 50.6 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c97c17bd167ef569db9a850914f7141fb8659e5f9bfaeed37c7931268a37334c
|
|
BLAKE2b-256 checksum How to use checksums |
1696ebf5f71215d78543a192eea183a1f097dc55ad7512b854cb6ad904c77349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 208.9 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
291c95659fd3bd25a7a6917dcfffd7f1c8c253ec832662a7cfa3c8d74234a530
|
|
BLAKE2b-256 checksum How to use checksums |
23530843ef38885bab1d5750e0484b1e5566987c7733ddc58b51201faf134d14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 54.3 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e457e8bf87bfd21b476618aa474bd35aa28e0e006ec6daa34fba9bfa31fe11e3
|
|
BLAKE2b-256 checksum How to use checksums |
a12a2375d895415bb6d1f8bbad7a1ae2256040270a203fd66134227b344fd77a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pgpack_dumper-0.3.5.4-cp310-cp310-macosx_10_14_x86_64.whl
| Download URL | pgpack_dumper-0.3.5.4-cp310-cp310-macosx_10_14_x86_64.whl |
|---|---|
| Size | 53.2 kB |
| Tags | CPython 3.10 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8156085b05e037f3d717632c190b356b6eef4f1e91b05cfaa018f7b5cd613aa
|
|
BLAKE2b-256 checksum How to use checksums |
546df34d0d59fc27e0b41406bb7130f032c468b4e0fc35cabc8adf86e8a1c4e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|