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

Uploaded CPython 3.14Windows x86-64

native_dumper-0.3.2.3-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.3-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.3-cp314-cp314-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

native_dumper-0.3.2.3-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.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

native_dumper-0.3.2.3-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.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

native_dumper-0.3.2.3-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.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

native_dumper-0.3.2.3-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.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.2.3-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.3-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 df9eba1215fdd572693a42fb71ff4c68147ffac5f7cdb009cf7fddfe241175bf
MD5 1e0ff287625fe6939095bb55cffea05c
BLAKE2b-256 c1159f93da0a6c04eef5f638a194bd74fad46129ca902ec0c824b06d8e4494ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 52591cecbfc8519acd4e855cbfb203c0797593acc726cd4d9854bafb22cde0b7
MD5 746fb4159aa614313e397e1a8d798c70
BLAKE2b-256 d7978f7def34f2b9241735dea08b1a37c36a3da209be1070b739e78b0a6db4a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ed28978cf97f039c74b0e24e0e5afd71b5eb81272c7028e191f133eb188268f6
MD5 b4663074bbef7b82f432158e17517bed
BLAKE2b-256 471bd60bf2533e2801598ed65aca154c9308c72df3dbe836981772abc6632909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b88733d7ff8377d13f27fd09cd26db89d2da5985938aada42f9db5272cff4a2
MD5 cf6639fd14f779e8ccaf1d3ce3136553
BLAKE2b-256 f6e1e04fab10d8e7418cf291be62dce5cd7ea2feba587124fc46a2ee88d02ea8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 36dc34f8f5f3c1a63684260bdd4bdaf18282c2b557097100844711661ef4b835
MD5 4ab5358719853616cb17c6c3296600d8
BLAKE2b-256 fd6d222bb208e424b668e7eb47fbba708b2031e1af3556144f3c79c40329310a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b5e75184a88496b1e7871b3082a4d29a2e3c1fc5602395adbcab0f9d6a2b29ab
MD5 1b53f904a1cbc73f1bdff47e0f1b7a56
BLAKE2b-256 52babe60034bcdaf2cbd723f039a00a8a1caf87861773361e3046cb6a9446f47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b1ffae5a8a11b23be4954c99318e0ecb9277e7c785468cd59f6a43c2ead71e8
MD5 cd56094505b08e901970dff91a239f3e
BLAKE2b-256 ecaeac659373c5ea9e5ce5db249301d54751468bfa89b65c6228f03446190523

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9852951568ecc616037cc7ab1d71eafad10f1dce56e6aafe3c3c931ae5172f4d
MD5 e7e3e75b316dcca2231d56babf9cf6fe
BLAKE2b-256 d71722c0e414cd2055eccb4d12b3ad089c24436c3904f6e3ba0cfe2e2e26d487

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b51203e2825d8ee69e18af7304ce3ea55c95bad92031f45b6dc26120344eafb
MD5 8c1170853d592bf0ad0c7bf858047f71
BLAKE2b-256 19eeb65e0dfbdf91285518c57f819c1a7aee48d0e49eeee4ff822877055ec515

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 d9fd762a9ba78815de65e8abe236efc15a47062b6e0b46424571dabaf12ec1f7
MD5 9776b3368cf5e54e91ac937761111eca
BLAKE2b-256 9f998672137dbb4e110ca2c8fea6b6274958ad4ba662ebd72c1e0e76de110029

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 901d611d4883d72603fe593a7cb6707685f347b62a5040540542876a1b005298
MD5 230e73b6151b4fe0bcc58e256c7be5e5
BLAKE2b-256 637fbc2ce63179a150e84e015f29d46be3c2693f7788d4a9242ac972eefb6e74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 907a357ae7a866f75ceeadc062f6799c36873bf9a92c858d68fc76b354cee990
MD5 2a554d07283ed543b5b731ab59735445
BLAKE2b-256 41a1ca5872c5ae4e48b2c2c1874611a72f1eb36bf5ef1e5b2211a9c0b856808c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4e147d45a5a200c93c5d856aee280a8edf4840819bdda755470c2445f256aea7
MD5 40b2233525b34eaa55704aa2052db505
BLAKE2b-256 d0aae5433a11319831ebd0003f81e3a8b26613d3790b183340392699891c31d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea63a0b1e7196c5d1a73809829a4527b5e7d34db554557555292a2168e144398
MD5 9f4e0067d2279b978ef0d1075c63f7e0
BLAKE2b-256 21e639bc1e60455709979159258cbc49cc5031ef051e223dc058441e5550d60d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 0f991f9889de744630e50f38baef72b333951b66959d51ea078398dcc1dbe4f2
MD5 6aba4fc4dffd930b5e84ae562ad1adc8
BLAKE2b-256 ee91c2c8583f1f7f805c17cb712e24c8e421f61076d6c61678ea495bbbb9dbf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 829e2b064abf8f6f8a4c2a5ca1e1802a4ca46265fed9a4ecac5872a9ef9c588c
MD5 897c67b20dc265a8031c462677106948
BLAKE2b-256 d409aada810256bc8ae5ee62922189404dc034f555a81d4a9aa3383dce315109

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b840066f3f16671107d4140980a9bd748fd2eea2a464bae1feccefd8e2c55c4
MD5 c780e586b076c1967e442b6fc4a51514
BLAKE2b-256 7e9c2d84dfe27f6582f5d9ad89ba7e2ceaf5e9265b3b86e457a0830a09b727a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ea1bb40bab05f38e24e49d3f1e3b6acf0a7de55f247fefd866c9d5e7bad798e4
MD5 ede55fc2fef5f2403500a4ecb0896894
BLAKE2b-256 5e56f509ca0b9e2024aa96f9e36e206dce6195dad27484c02b8180a65a2eaf77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f29ad3a22f44d09a0f50509bd049684c15d1e42af21af16ba1b71ed9f65d5e3
MD5 82c5390f8837e82b3368874a2ef7ea50
BLAKE2b-256 7a7b74e94104c252a0518a2b3ee07036c9ec23c60898fd2634887b24401101e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7de88d29fdda4511bb693b2132dfbd59a6630c4826f3aaf91deebda45ed96db4
MD5 4444886656c0b08613fd2bc217ce14bc
BLAKE2b-256 c19dbe697cce8dc0bc9b04f1ce4b32fbca15c1f5f0290a673a0f019ab56cef7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7978fe37f33535ac247fe1a87b9e1044b240b069266be3c6f900c244e7c5189f
MD5 5528453ffef7625c7ba6a4fb50914c1e
BLAKE2b-256 a9fa7be237bf298b0bcc870d7a7bcc2903b4fb27b62415858076364c3588937f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7897e27dd09e9936fe5ffd7ab511e93dd7b27ef13fd932b0ab881baa468a4ec2
MD5 7b26d00ca52ca7ac4808586e10185dc5
BLAKE2b-256 fe6daf1343ca21e11150daba10e7b6c8a039d7052c292007e8b73577d3490a83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bd37b8186933a29181fe75b7ed28ea81e6f7a2793b0371a95b234d0cad99959b
MD5 18fe5723b97e025e054d0b067ff5995a
BLAKE2b-256 914054efb32ef91c76d54d9cac2f8d0970184697c036e34a0e4031e173178c67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b056b251ebc292fba29f7086876e0199b26e6878b5d8263abadb8f95ce0ba73
MD5 512957a6f899aaf606c028b2eda6ade9
BLAKE2b-256 2c1d557d67287334dc01475413a3ab31e9270256c27c55c5eb71e67e4c9373de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.3-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 b43731fe2dc0e553347a8c78d1cfcfef762cdfa102edb8e901286b5cfe4aea6f
MD5 8335797eaf8a697bb4ea1af01c3052f7
BLAKE2b-256 b471f2f370492834c66a795d51790e59fc3c23adf6d368741e1d60601885af34

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