Skip to main content

Library for read and write Native format between Clickhouse and file.

Project description

NativeDumper

Library for read and write Native format between Clickhouse and file

Examples

Initialization

from native_dumper import (
    CompressionMethod,
    CHConnector,
    NativeDumper,
)

connector = CHConnector(
    host = <your host>,
    dbname = <your database>,
    user = <your username>,
    password = <your password>,
    port = 8123,
)

dumper = NativeDumper(
    connector=connector,
    compression_method=CompressionMethod.ZSTD,  # or CompressionMethod.LZ4 or CompressionMethod.NONE
)

Read dump from Clickhouse into file

file_name = "native.zstd"
# you need define one of parameter query or table_name
query = "select ..."  # some sql query
table_name = "default.test_table"  # or some table

with open(file_name, "wb") as fileobj:
    dumper.read_dump(
        fileobj,
        query,
        table_name,
    )

Write dump from file into Clickhouse

file_name = "native.zstd"
# you need define one of parameter table_name
table_name = "default.test_table"  # some table

with open(file_name, "rb") as fileobj:
    dumper.write_dump(
        fileobj,
        table_name,
    )

Write from Clickhouse into Clickhouse

Same server

table_dest = "default.test_table_write"  # some table for write
table_src = "default.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 = CHConnector(
    host = <host src>,
    dbname = <database src>,
    user = <username src>,
    password = <password src>,
    port = 8123,
)

dumper_src = NativeDumper(connector=connector_src)

table_dest = "default.test_table_write"  # some table for write
table_src = "default.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.cursor,
)

Get NativeReader object from stream

table_name = "default.test_table_read"  # some table for read
query = "select ..."  # or some sql query for read

reader = dumper.to_reader(
    query=query,
    table_name=table_name,
)

NativeReader 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 = "default.test_table_write"
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 Native file format

Get info from my another repository https://github.com/0xMihalich/nativelib

Installation

From pip

pip install native-dumper

From local directory

pip install .

From git

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

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.

native_dumper-0.3.4.2-cp314-cp314-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.14Windows x86-64

native_dumper-0.3.4.2-cp314-cp314-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

native_dumper-0.3.4.2-cp314-cp314-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

native_dumper-0.3.4.2-cp314-cp314-macosx_10_15_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

native_dumper-0.3.4.2-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

native_dumper-0.3.4.2-cp313-cp313-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

native_dumper-0.3.4.2-cp313-cp313-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

native_dumper-0.3.4.2-cp313-cp313-macosx_10_14_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 10.14+ x86-64

native_dumper-0.3.4.2-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

native_dumper-0.3.4.2-cp312-cp312-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

native_dumper-0.3.4.2-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

native_dumper-0.3.4.2-cp312-cp312-macosx_10_14_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 10.14+ x86-64

native_dumper-0.3.4.2-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

native_dumper-0.3.4.2-cp311-cp311-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

native_dumper-0.3.4.2-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

native_dumper-0.3.4.2-cp311-cp311-macosx_10_14_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 10.14+ x86-64

native_dumper-0.3.4.2-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

native_dumper-0.3.4.2-cp310-cp310-manylinux_2_28_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

native_dumper-0.3.4.2-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.4.2-cp310-cp310-macosx_10_14_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

File details

Details for the file native_dumper-0.3.4.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 e7f233297fc41cacae91c0a83cc754c54b76d84e9983eedee0437a4386af687f
MD5 5f6d9a20d1419279c29dabd241fa9e89
BLAKE2b-256 32c90f857f008e21787abb9b6fc8627f6722fb555b86a25259bef6ed739c9bf2

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a4ade429009313aa2d2c341d2688e09854865aef9b52c9f5971a5d1cfa290f35
MD5 7cc3473107512e8f54fab6bf83eee21e
BLAKE2b-256 1b97a57689473f645aa25e1abed78c8bbd149146b05af9df458f68b1aec4186b

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdadee80ec0e7d9d327c0ac7a80b7447fbabf2caedd1d0b84871e07f4cdebeea
MD5 38f62ecd94e4fed91d4cab8ae172bfc6
BLAKE2b-256 0bf210e8a0936f3477f0406647c7474d24573962f6342643d6849a32e25ff6f9

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 2649ac124c9ef0300528f0d8d207de44a89e2bbb933f5cb53bd042e583246457
MD5 234b81f6daac282f5d1732ec56d9a504
BLAKE2b-256 ad5ad352b575faa4630671ee1749d7941b3b94370088ac55d5349d8738739ad3

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d41973fa48a7a8fd1ffa6ef69dc3185d27512f9c63734ba302788d1642eae2a5
MD5 7b4daaba7eb592b1f3822ba70df0a8b8
BLAKE2b-256 8d8778660e93e8a41d8f30071fc15e624c2f71158a10dac779992abdf30a8540

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ec801fd657ae22953755e006ff62b6868014b9559eaff61390448d6770098adf
MD5 33570bae63f9985aee004f6dfe21468d
BLAKE2b-256 cba2957c503e69064d3846ff0e648e53c8817b3ae2aaf74dc1029909df0d033e

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ba3aa34801485666d3a02dc2a3e7ba5b81f9d84cbbb438bcc50ffd84d03a3ce
MD5 7c6040fb78f8308855104c4023e9a080
BLAKE2b-256 09bc6b26a382627c0b2c7134f84c88e30a7734194e5534643d2d41a0fab13d2b

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp313-cp313-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a999eda9b6f1daa99e34b4d0a4eda4b8b84f70b3eb1a266d32f0e55472edc70e
MD5 3f52f12ed6296cebb1cb15a836d81fa3
BLAKE2b-256 7fa39309a5f44f82638579ad0667a3dd8924c176b0eaa939f3519a0146bc2361

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eafd41b5a1cc6d2b2ed50952cb8df6f5026a5722549520500d1a64696ed9e6fa
MD5 be3d64735a67c6c8fb55ba4f0b83a343
BLAKE2b-256 d519e51c54a83f05c321560ebc7184b1d71e45050fdb2e567f2c445560a93adf

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fdb1970b32e1fda38f23dd2d049dcb911057fe11776075c5e8f716da129530a0
MD5 bf13c14299737c797880350fde500e89
BLAKE2b-256 2c5dbb293d00a3cd2fb71ba408bda0d3b8c1114b06dc0c1ff6060fde76918fcf

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c13359647f548e6e57b9ffee44f2303aff1cef461f8485bfc7a32223e6c1fee
MD5 553eccf63edf4bf07df5a96d5bb07482
BLAKE2b-256 fa2baa3b31324f06b2be3353417ac55b86ffdecfaf1fd7a117916c304672908b

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp312-cp312-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 a63ea7fc9cbc6c36375a2bba2ac69f0902456c0b2fdf866de3da5aacd3e8fd99
MD5 1d1aa7946fab3cf30e8d8cbd55fe0ad7
BLAKE2b-256 1b636eb6efed3b74d5103c742ef43d3136636a5336fe2c793b83f177d2b7bd42

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 18f67659b5865d8e268f8be871f13d4dfd289ad26e4dae9b3d34c9844001d31a
MD5 685dc52f3cffe4cb89e74438dd8a792a
BLAKE2b-256 5d577d5787012b7393d683a3b539ed8738f5cdd2d9ca95ef5c09a84cb27ae410

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 690da6dbb170bb857467fae5d723469d501d926675d1b6d6100fd7fb08edc7c2
MD5 2e23c11d81c08491b39ddf2772c39935
BLAKE2b-256 cfc0e88c857091282309360d5250c799f207e923d8b4a446afa89fdacde6d7cf

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86cffa316ef43071cea947587611522df027e0542507dc333b74bacb58e07c44
MD5 bc42a2e958c619fea5a46a2721ac2f23
BLAKE2b-256 fd82e1718cb83b1c9f2f6240682ec881ff41d580e9cd110799525b0aeb2f9f59

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 77040629b26152ef776588aefdf1cea96bd54ab93f9378735fab27967ae005ac
MD5 7d199857b1b0fd417d7d0e9391e03aca
BLAKE2b-256 dbc2a1f2813b5017f04b9dd75e8b3a7a3cd7e893ce021d0572e297e2a1db72f6

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 569399e114731e0199000fd8aab579f0cc5160f9dd07edc7190241b89c5b7462
MD5 518a0b78b9223db089c61ae725635a7b
BLAKE2b-256 69853b4c759ac696cd6d8902f15263490b1dee712153f17dc9f3c9216688e54f

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 26b5de14943e7b6ccfa7de5895d8fe28d17aa5e90c15c1f200c190f1b3e844b2
MD5 8653bf71842742f12037849f738e9b8e
BLAKE2b-256 d507102e9e4b3cfb5389d49896db2ebe8005b191fc78a3a5c5f7ade2ed394360

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2fb40345ddcba6e6fa3ff9e9d872d00d6553e995a3a4789ffc0a643868fa2f1a
MD5 a6d2dc38d2b9d082e7a64f47a539e9b2
BLAKE2b-256 49dc282a2c0b960a1e7371999f560bec10d0018aa45c33437b1217b489a1c597

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.4.2-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.2-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 cf4dfd830817ddb3d5b942fe0469f2f2347751aa99ec1c018fad32829feea42d
MD5 9ba9821ea8d8ec2291e4e75458f86ab6
BLAKE2b-256 6eac1c0ad728cfa9f422657214aafb00e62c8fad9d3f75d2d4751051b8e6f69e

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