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

Uploaded CPython 3.14Windows x86-64

native_dumper-0.3.2.1-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.2.1-cp314-cp314-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

native_dumper-0.3.2.1-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.2.1-cp313-cp313-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

native_dumper-0.3.2.1-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.2.1-cp312-cp312-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

native_dumper-0.3.2.1-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.2.1-cp311-cp311-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

native_dumper-0.3.2.1-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.2.1-cp310-cp310-manylinux_2_28_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.2.1-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.2.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 148056a4f9719b1e0cecd275790a2329de3de8be06dcc85263ebdea349a37073
MD5 a6c59b101058b7165ae9dadcd2e16e8e
BLAKE2b-256 96191a84d3f0c9014296743a40add18ca6586575d1ee0bb818996431b387277a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 011a1315d58368c584001ca15cb29bca4e58b1f13abb7ae1d10802d02da25249
MD5 4213167e8be2b39b8115f9d237803b4c
BLAKE2b-256 586b246ba6723c97d6ca0eb2dedc501b8a4c399f05f1e02f9e8c3287d6fcce79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 60da9010b3197cff58e53f7de40532a5f841229a799586e507528369c16e38a8
MD5 a98d70cb38089492e041f10d33193cd9
BLAKE2b-256 fd8c17d605c45e58656d3c932a48d4fe50ca8cbfe52c2254ddc24afce5a97eec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2895c90172830c67b43f588e31320aace334f159ae56132baffa376691f40503
MD5 9059e885e3105771fb46556eb9d70c90
BLAKE2b-256 1d1bd95dab0a9ef3d0957f073c2d70c7d15789226de93014d72c4de4acb96c52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5ee582972b86e6e343af1c601da4d17f2783a5d519e43bc9b9494a834b95f6ed
MD5 de87c423c6103237e431b5cc1d6f6a5f
BLAKE2b-256 85bde3f9814fb3d3a2f2641d4fc06d4a8fac204c15bc16e29de6fa80d2fbf8c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d9ead637fa88112cfd600fe53825714c0fea06700a32c014b149ca0ff1d88dc0
MD5 5dbcf8b17526e067800d13e611c3c7bf
BLAKE2b-256 aaa67b0636141347b334581bf2dab31fee3175603ffce76cb9f8622e063f0d1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 107ca8b3e3cf606255756367c6ae8745f724bf148a78ae2c9b95b8deda84d65b
MD5 d77588a8ead620f439cdfab4380b42cd
BLAKE2b-256 e711ec7be377f30eb675d6d72d7df8e6eb9077e1b6f9fa4f4f22852f1c903f2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 77e505cddec4daae9d445046443505d868ee2eefe7d281742339fbf9ad682cc8
MD5 0fce9f7a03f3a1ade9c7474a04707767
BLAKE2b-256 a2178322ba6feba581bab067c45a6c7f81debf9fae9429b934e3e9f5fde979c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7344a4a1b37757668549f963dd0ab903a62f61fa3ea2535aa3682ad317cd04de
MD5 abbdac0553adea3fb17efcf3567d49b1
BLAKE2b-256 0a51647de6b76868e09e362cafe47c52e896fd29d5ed04e00d1c8f243c1025de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 c8b4d830a72ffe9feff6e4c6f1a146173024ee99989ff1db5559d362fca5df1c
MD5 832283198e079294e4b042e4a3d1c298
BLAKE2b-256 a93efa8b64548fc7fd079e3c52284463049ac49d2de156a0ab7f3a74d3c9c931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cd619359c15cbe05161f0ba02b3266f6131f57980410254a42b6f5d4b78a2f1e
MD5 22d2a96ee9ecc95ee74e948782ade97f
BLAKE2b-256 30ec7d736dbfa9b8fde8993f0f3f62de3913d6d3987c4a7206a1945bc18b48c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38d0ade00b329634a581e120010a260fd5653e6f22f516edf88c810cbc0d3bc0
MD5 33ce2f64f711b34977535824116c4bea
BLAKE2b-256 489ebc55dcdb31851d1cf139a5612e96ff203a99953625a15b562ebb4278d07b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 abfd8f2b9a6189a80220c8acb2f356ef90ed12d93f8360486e535f8062e77915
MD5 d1be38905a2327f9f8d5d830c170c06d
BLAKE2b-256 b590812fd43b28cedad53c750a6c8d646a150e979e8f36be3a84da600f4fe660

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82e982e0ae6f5d9425cb7790cdf7065bc21b6647fd0ad6b303083f745214d3e7
MD5 768dca29b3415b38666f077641b7c55c
BLAKE2b-256 73f35fe635836d214de059d0dda8babaf82a395ba285583a22ba199161918cdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 be74313d31b13a5eef1c328645f83f0a5edc024c481837d0f8e2e307e1638053
MD5 640e77d637a971bdd26f6e8fab59ef62
BLAKE2b-256 ab55304774659bcc0e8de8098e8d881808372930be6f183c6f579923fd86b003

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 143b801f53e490ee7c2f2712cd42a04c0fcda3b4be2b1e0d2c4a5d6535db4bd8
MD5 c46273f592f4878aa6f725a20a14cf15
BLAKE2b-256 9ee695372eee01c79fa02de9a765fe18675b08b5288670a920f01d4a1a9dfc0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 845d8413134eb2a45bccbba072f7f01a356b71aa5b732fe2bd9caf74eb56814c
MD5 41620463cb1033d307b078ae2add68c5
BLAKE2b-256 3df6e620f266bcd2fe966508e5426e9b867c9025509e3f8bd2304361134d4596

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5d5e665334d8f809b222663680e34a4682ce874ed1157f4bc7d0124de70046f4
MD5 b07f3572d60638a24546491ae07bfa4c
BLAKE2b-256 c1deff441f045ef6192365cb0b916ee39ea17ae4067bbf55424083d1b862dfa5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c81d6181489ccb899e69006afc64a744acb2074fd6fcc3a32ebd7605dec7dc7
MD5 b0358fe2e708526c96674b7187cb5c14
BLAKE2b-256 cc3be833e2550778c8db310f3799998702cf76f9001b55dc4f7e097d9019c973

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4e243b97a5e532d3cb6f36cfdeff01786d6125030383eb383c30f9459f520d67
MD5 b964248666fefe6e840fed7287e2c6fa
BLAKE2b-256 54a1245365c5ae14e1aacd43985cd555443145f45f2b81ceeed93679beb9e6e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 28b4277475e55f80aa07507a9a14601affc7445900c563007664d6ee73a163a0
MD5 4cd8c4a7cbd78edb7bcee505a2e99935
BLAKE2b-256 1432a37179f22259030a3672d100814856223b28d57c384f8eb81f2b8073504b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 afc60840f542ba5249310ae926a5f61d28d0f456c07d52d9f2c0771a195d4e1c
MD5 7c94c88cc9110ecafad040d9e09ce345
BLAKE2b-256 61a9ff287f491094c6c1e9cb995790d7650dce79274e84c4f1e1b6c41fce0245

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 65284895ce6bca0fbb883865c51ca21e5abc8ec7a084b2e41302743feff5da19
MD5 9de1c5200deaf14252da06a9bbde5c5e
BLAKE2b-256 dbcd651717efa79759df1cd3c43c3816cf621daa6dc81c742e19b50ba774bd84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b122be6b1ae4d2604dc48d1ee2a11eb48fed98a91f64197a5bfefb4d9d7d478
MD5 d82e10ff0f0d447c89707939d15cfdc8
BLAKE2b-256 bd865b14dfd649b6be4b90a6a3e5509e14db1ef73f1763fea464728ad3e0c98d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 aba5e6f8e1fdd74e2221420394fd8452c627a867c5eb7824c0cb78c9c2af341b
MD5 19f83b20780871a8e1c04890b31aec91
BLAKE2b-256 51bd5b16aa748562fdc44f1fbcfce444692028a00d6fda338312c633a71f380b

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