Skip to main content

DBHose dumps convertors utility.

Project description

DBHouse Utils

Dump convertor utility

Enums

CompressionMethod

Enum for select current compression method

  • NONE - without compression
  • LZ4 - lz4 compression
  • ZSTD - zstd compression

DumpType

Enum for dump class classification

  • NATIVE - Clickhouse native
  • PGCOPY - Postgres/Greenplum pgcopy
  • PGPACK - Postgres/Greenplum pgpack container with metadata and pgcopy

DumpClass

NamedTuple object for DumpType value

  • name: str
  • reader: object
  • writer: object
  • have_compress: bool

Cython functions

columns_from_metadata

Function for convert pgpack metadata to native column list

metadata_from_columns

Function for convert native column list to pgpack metadata

pgoid_from_metadata

Function for convert pgpack metadata to pgcopy oid list

Python functions

chunk_fileobj

Function for make iterable bytes chunks from file

dump_convertor

Function for convert dump to another dump

A dump in Native format can be converted to PGPack or PGCopy, or you can leave it in Native format but change the compression codec. A dump in PGPack format can be converted to Native or PGCopy, or you can leave it in PGPack format but change the compression codec. A dump in PGCopy format cannot be converted to other formats due to its storage characteristics (no metadata), but you can change the compression codec for compact storage of the dump on disk.

Example

from dbhose_utils import dump_convertor

source = "path_to_source_dump"
destination = "path_to_output_dump"
dump_type = "native"  # Native, PGPack or PGCopy output format
compression_method = "lz4"  # lz4, zstd or none

dump_convertor(
    source=source,
    destination=destination,
    dump_type=dump_type,
    compression_method=compression_method,
)

dump_detective

Function for auto detect dump type and compression method

Make current reader object from dump

from dbhose_utils import dump_detective

file = "path_to_any_dump"

reader = dump_detective(file)

dump_recovery

Added dump_recovery function to recover data from incomplete dumps

How it works

For pgpack and pgcopy, the damaged archive is recovered to the last valid row; for native, the damaged archive is recovered to the last valid block. Why might this be useful? Let's say you were dumping a table and at that moment the server crashed/the connection was lost/some other force majeure occurred. Now you have the opportunity to retrieve at least some data if you need it here and now.

from dbhose_utils import dump_recovery

file_path = "path_to_broken_dump"
recovery_path = "path_to_recovery_dump"

dump_recovery(
    file_path=file_path,
    recovery_path=recovery_path,
)

Installation

From pip

pip install dbhose-utils

From local directory

pip install .

From git

pip install git+https://github.com/0xMihalich/dbhose_utils

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dbhose_utils-0.0.1.5-cp311-cp311-win_amd64.whl (53.1 kB view details)

Uploaded CPython 3.11Windows x86-64

dbhose_utils-0.0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (259.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

dbhose_utils-0.0.1.5-cp311-cp311-macosx_11_0_arm64.whl (59.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dbhose_utils-0.0.1.5-cp311-cp311-macosx_10_14_x86_64.whl (68.2 kB view details)

Uploaded CPython 3.11macOS 10.14+ x86-64

dbhose_utils-0.0.1.5-cp310-cp310-win_amd64.whl (53.4 kB view details)

Uploaded CPython 3.10Windows x86-64

dbhose_utils-0.0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (248.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

dbhose_utils-0.0.1.5-cp310-cp310-macosx_11_0_arm64.whl (59.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dbhose_utils-0.0.1.5-cp310-cp310-macosx_10_14_x86_64.whl (68.3 kB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

File details

Details for the file dbhose_utils-0.0.1.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8b7ef63ea0fd74f76c12021ed5a293e707e0358164d48ea22ef670673d8dc516
MD5 199d9f242ac1e4e34f5890513549469e
BLAKE2b-256 61bf94be15814ffa182884f079be5a0de0d0e2ee5bda02130086ca9d854c627a

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 014af8bc039d90527a565dfe445d565c9368a060419de8e7037164a45dec12e2
MD5 9af0846530f065369c366330bb5c6d40
BLAKE2b-256 daba96511735c220172cf2c973001c551dc5a2a4fed1f7d5568c379fc44b6a36

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c4d77747337c46158681021f7540f5ee86813bc8a6af87e3bc740c9040d7965
MD5 dd9695a109ecd13e00fe8437f2d388b2
BLAKE2b-256 423c9bb7b429d65a4536bef2ec1d4b2b7c8052e19eb2aaec7c3f16e80e88df20

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 9eb1e27941ed400b90ab078fb38fc89ff9d27add294294c745b75ea810d4f311
MD5 041fcdad62b0730cc5ca3e614beaab82
BLAKE2b-256 d94c11dd6e08ad38304570f18b4095898bb0bea1b5bf2ff8d09b3ed1f7428f51

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 825aa2c12038b7fd8e5ab20b49485a4407e6521e4d8c9022f2c050af23729b05
MD5 cc69b7346051b6e7811ffaec980a4f4d
BLAKE2b-256 6bb7cf6fbaa723db499335c4308d2c788b4eac48d51926f6cc0de79f39ef4192

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67f42ff43f5da6d425c18ea7334400d293dc82823078232d0e49eef972b566a0
MD5 3092c45216077f36293964afa0cd5d74
BLAKE2b-256 0bfd63b59ccdb6352978a54e4c5fdc73a2daadc788368b8f3089f284670cd750

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 222dff271ead2cb39e20f890f1c8aee5144435c5e388648c9ef6a3901cc8eb35
MD5 53c5fd1f96cd35981a64259953b0a7b4
BLAKE2b-256 fb591f0d1442d34210c61b418d68ba6c43859d1163f21cdf6a803ba9de94fb70

See more details on using hashes here.

File details

Details for the file dbhose_utils-0.0.1.5-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for dbhose_utils-0.0.1.5-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 05b0988857dfdd84b90c7811057cbbd7ec74038abe466f1cc53044c5cf25b750
MD5 7444f0cad3479e22a57d50b8816a9c06
BLAKE2b-256 72d15dc629e7eab04ef0b734690f0964d74e63d140f3aeaa2a347ee9e06fb815

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page