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.3.0-cp314-cp314-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.14Windows x86-64

native_dumper-0.3.3.0-cp314-cp314-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

native_dumper-0.3.3.0-cp314-cp314-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

native_dumper-0.3.3.0-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.3.0-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

native_dumper-0.3.3.0-cp313-cp313-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

native_dumper-0.3.3.0-cp313-cp313-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

native_dumper-0.3.3.0-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.3.0-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

native_dumper-0.3.3.0-cp312-cp312-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

native_dumper-0.3.3.0-cp312-cp312-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

native_dumper-0.3.3.0-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.3.0-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

native_dumper-0.3.3.0-cp311-cp311-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

native_dumper-0.3.3.0-cp311-cp311-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

native_dumper-0.3.3.0-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.3.0-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

native_dumper-0.3.3.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

native_dumper-0.3.3.0-cp310-cp310-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.3.0-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.3.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 b0baa1e5de864a80b8d6d330c70322329ba14d18855ccc7704d5d3fb5173e8d5
MD5 d0cfdb73f1eb66affe32be0526ee426f
BLAKE2b-256 ab00d002c3d70e7208ab40642938ebdc6f159b11bd7b5bb30944c2755de91371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7026d8548eaa44e136062aaaa4fffb43d006991000f94009bdae236cf95e2c12
MD5 fa7be5658347da410e28109845c8453c
BLAKE2b-256 a0d95035c9e3cd791b9c74bc7b673e49a37baa6b3c7751b883589c6c5f9d189a

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.3.0-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 05c8637b4a2bca5b2dd43150532d49ebfe044f0373aaec2895c1a9b805bb0e8b
MD5 92acafbd77ccc73f55795fc0b26c33a7
BLAKE2b-256 4d7d63264810e476a8a3d0809d0c60999aaa58d68b4f7f7ad3a5183ea7b54062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27cea5b9cf5a6818d73eccdb6574fc40a97ed7b4106e3b1dd701956f4f7c2045
MD5 aae52b980fb424f6fb9c807ca8c00ba9
BLAKE2b-256 42a6744d2033f91a8cd19263b9c1ca19df653c50218d8d6663ed36ac28e0991a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 368e0df98cdf31da3e451172c0915742af33eb2aa841121408d49fef3030eb2c
MD5 80e33f57f88f2da7469121a10ffeef2c
BLAKE2b-256 f9dbcaacbb6e81d098036b8fd9fb3afdc8f37893c8f2a27f6c61d601775b5a61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ae2ea2f1834bf578a05d377a04ad360ca3ad2726b7644a1828d4f4a1daf8b2ad
MD5 d1c93192c013483bfc69ee7989499251
BLAKE2b-256 697625863540c07ba623ace7bf5aff6047aca3192a06621983c1a6fc529252ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e4cff5fb965806031b047f3b3d999f88cc056c6a15ac8456565b92b36981ec8
MD5 22489c35595e5bad38555284915c1c36
BLAKE2b-256 111ea96a0b6b6fdd60a66ae9f177fd244d674b69aa33869bc1dc5e418524c72a

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.3.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dfba558a1412c824a17522552a08af861545eaac03fcd4065462d79c080e43bc
MD5 0455fdff8ab8e2845aca9f4fb75c3f52
BLAKE2b-256 3a86b0c40b6c1011f7e6328dde752fecde9525334c69d83027475df6c4981c66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e1229a141e4a9157ccdd11b058dcce438ad0286226106a54e3ada5bda640b7d
MD5 7e90f443e89db27cd17429228c8a6aeb
BLAKE2b-256 17fd720c031cc5ff3064713b21a6502df9c33a137bb84bb9a82e0c8af1ad5f63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8011e60ace6cfdd3ab90f2536360a1ab542b55a91ee12e75d6318944112a32fa
MD5 34eba4d8d67ba3d9b831dbf2609c30c5
BLAKE2b-256 286c918fd8bd05c87ab0ce80d6c3ee9c1bfcfe5ad8cf4848bfcc4a9651a262f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b5e8acf67bb70fd1526634253caee9eb3629b415c2e1c1ecc01ebf9608a6d10
MD5 182db5481ffa22ad6b82663df221d01e
BLAKE2b-256 8234b8d22bc03382bbcd6da49ef65cdcfb86dfe5aa3c0ea50ec751c9f1fe59f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fc2fbb89ed849a989f42f72fea6ca2438ef474ec1ece36eeb1534e29a2cae2af
MD5 2e0fbcfd8cb19f9be52d23f3fd5e5799
BLAKE2b-256 e5c8088e3df6c55c624d16ff43d83c294b84d38e7aeed7d32a5bdd4e6420285d

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.3.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9620f481474a3f9b22e14b87d828967a7da31902c74facf484a0726e3e1cf374
MD5 e8c931b0a2db5164e70a32ae3267589e
BLAKE2b-256 ab0fbe7f0f37339715b54728c5c4372ea5f413fa2125a5df5a32dbdc4fa7a68e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bd3a0a944d855efaf24c25f72d1e0ba97e7133a82a42ab877c53e8f24ca6c33
MD5 4b3ed88bab92863def2ed3d6fd44b66f
BLAKE2b-256 a3fbc79de5fff8ab7cd666dbb66ee23d701d22f01040145d85750f1ceab125f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ca6b78fde8642f82b0d5faacc2858b8a05e89c35c4d69f23c8f094779ff3ce04
MD5 2cdc7ebcf1592912be212de5c03eaaa3
BLAKE2b-256 d610798576e6fa95f76b1661739ffddf8d9d9bbd07eb736a2ba25ef974c68ad5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6f59fe7ca945d2db240dab35c1e574b20952c8f3efc12415523eb429b8f616cc
MD5 c11e34a3648c5a72b2b110959b0a09a5
BLAKE2b-256 bb1d6940fe736ead36d6c734f38fda4696db76d6c6a39d4be6749c48d159caf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ca6baaa7bb1c83b63a362429192e4f85977f5df47809bb1e07b0f34ea473036b
MD5 33a8287c73c9b5875b45ba237f6eec61
BLAKE2b-256 0a51da031a5a72b998b6815cd5614b8dcc7f2cdb2a4b8c8d7c30e5ca8f964711

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.3.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 568fd3ec1d094f41c75bf082acd3df059111ce6188627d0cf0d7e6b6a711e23d
MD5 45fd21aed2fd2d9ca503a8bda451efaf
BLAKE2b-256 6bb4b54c4589e1ff8b52a678d14e1ab2f120eb0bbdb93ec1fd94fe589498e9d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4a554d6238c1e584044c88b968e87395c746f386a68419dde2a901e8b4f280f
MD5 e09c1f4685dded4212ec72212deb4196
BLAKE2b-256 6f9b8db724fcb0794f540cf14c0c25568134b047d3db000c54960c9ba6605660

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3b7e5183afe2998e9e7cf2ec62d4c99e3e08e7d7d9136706e1b747a391e04245
MD5 6d2b612f41a1cc6f56e51dbb9df23b98
BLAKE2b-256 9e9436844a12a45121d0255e2f749405426d40772f254f70fb0666febb7a6a5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 05e92e461bfce334eb6e15c7fd98f74bb635c889532bbb8365dbbc06a1b319b0
MD5 42e5f392e6fa5107190b1d944cccd938
BLAKE2b-256 46269c99a4fee82dbe6fc1a21ef9d16ad245809206553bda235acfd4ed48cdb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea7dccfb20ad9008df9a3d46c15982609ef6b5589fcce9b74397eb23d27c1039
MD5 79b4c8237236d3d58fbb23ae61af035c
BLAKE2b-256 ed0acac2c23a61845f63044a6f204c6ef581d6078ba13b71302ec9d9133a4d85

See more details on using hashes here.

File details

Details for the file native_dumper-0.3.3.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 34c9d7946f575615909b773293d58e0b5131d151337e42dabbdbdcb662ce6d1b
MD5 5d72d2c0ac28fb0f72c74c55c37b8b43
BLAKE2b-256 515e60f24c4aa995159a3e7fcc957022e555e14fa2a449c57b01cc17760cf7d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d3d06af71468a4e0648789ca0e9980ab52c291f02d48ab3c72cb92c35f63372
MD5 31fab69be9315eb2f77ade16a3a17b0f
BLAKE2b-256 f90993710c192a7c262d87baf7854a05a90a9230781becb108258c46d4954b28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 322a8a3a95c5fe595a9843c30fe424783e3fa6f552bbb281aea1fec1b33dbd99
MD5 d0e286d3d67ebf59de5e6dad952671e7
BLAKE2b-256 4474246d31db483aa2fb9a2711e0c06eb6dacb460de8df1fc90fd7f4c4d06e3c

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