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

Uploaded CPython 3.14Windows x86-64

native_dumper-0.3.3.3-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.3.3-cp314-cp314-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

native_dumper-0.3.3.3-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.3.3-cp313-cp313-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

native_dumper-0.3.3.3-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.3.3-cp312-cp312-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

native_dumper-0.3.3.3-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.3.3-cp311-cp311-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

native_dumper-0.3.3.3-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.3.3-cp310-cp310-manylinux_2_28_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.3.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.3.3-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 bcf1c22d37e1ce829e468cb792c5c873753f1d098b75bbd78b2d701355608e50
MD5 62043a7ef02571f2ce63657b9426bf2d
BLAKE2b-256 5b8c28528879bc3e064fd05d21ca6f223bc305cef784bd54e03d188f17df28c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b1833ecfc9106624f9c52d510c9eff29be78f9803dbeffd8992abfd4fb6f0e19
MD5 1e1b98f510d5d346249256efca3450d6
BLAKE2b-256 ff68e6a37f0b649f768870af52682d03a3a3ea8ca1d3d2e5299926262570e6cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bb04e719df8b6806f11262ff9387fb6892e02a08e2600c7068d90efb0884a2d1
MD5 853201b928d07357f4fa910193e88839
BLAKE2b-256 cfbd1d6f552189d13dc72ff23cf8b55e7861a6141318dfd7967418c28bdfeb75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5bbde8b71eca0207e20be1d85631c09f76bef3a7e8460b29d3988c68986d105
MD5 e7e619ff6f1b6a085022bfbc10aeb86d
BLAKE2b-256 8beb909d5263324ff284b70c1abad7e147b981217f3662112b5d6d1e56a94fb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 44854563cb55d2293bb657564a5692dd28404317cb9c9b0f3a5916123da284b6
MD5 5745e9806d47a79ca5b9d366230d9359
BLAKE2b-256 318b5d7e422f8b1facf04c6a595b65a28f20ec65212840b75c04560a1cb4a76e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 76de5556ffa54f3789d8d5365b0dabcd2d1b4ba6672e2de2ccb3d98c48993147
MD5 8bde39b376d94239917ab6d2996c3643
BLAKE2b-256 e055ed7881096c0cdc565c76e5785cc0de48c552e6d3f127ef19fe520e713bfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 360aa9e572511b5f9224da8232f92b9360788e0ce5e1aca7a49c1240dfa22bfd
MD5 74b03d1caa01be92d27f5e93e8d00cae
BLAKE2b-256 0cc74dab24b1641cc2ae91a9a7913c7e9146f551684cbe0f138166ff6dfe1942

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 21029b5e89d2fc074db8bd60e4f58a04877ab1013a404bdfdc90625c3466c2a2
MD5 51ce2cd1033900a2f3d8de557d99da9a
BLAKE2b-256 953ad070b0dc71f8c188e2b69be393cc81f49c301990b83cb1aa34764ac6e926

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6ae71c3a3d1bbeef6f641985825a1e29e8df8fd2530b3705fac820607f2bcd6
MD5 165706dbd4f8d3e45b8ad578b189c82a
BLAKE2b-256 beeb31a9bf5a9dec4381eb062a16223fe56e48f002cfa05e4d7e83f40c8bfa87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8787a07a068c906ddaf2479899821245eed20ea414d52c2f9e774a44e1d11a4b
MD5 cc74cfaf84eca75e2ed378de8efc6bf4
BLAKE2b-256 0b66fe6605f3e4153c35e73d997ba8d329abee1e9fc86b3eeb8c0aed61f2312e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7a8311a57cb99b62f3961bd8fd6b552f029fa6a1014cf996e40df1fc275b0995
MD5 2fbdd02b76519e3a0d1a2ee7dc6874c9
BLAKE2b-256 a1a99dea0722740fafbd67c29b366ee4b864ebe8447ddd1756e68fa8c2d65058

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b38054251fd7e7abfa503818affd9ecec8afc304bdf596ccc32b90f76c7fd04
MD5 cf99d435d8ca09af15e6bd16d1a8b564
BLAKE2b-256 03f42a494254f54d26fb2bf57128a3516db00a3066f6282276705d3347623239

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6404afe7a32f1f72237e70b2366e47e440f6884610a0cd91827e2feb7a98e7a9
MD5 003a26b8da8e27a3251657d8b69c666a
BLAKE2b-256 5a9df730de6a1fe12600bc1f1c4762473d975b7eabe55074183c1ac23963487f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46f0c959bc9fd8b2ea0a7f68c60dab2fa59760472e753d8d0fb5228dfbc4aa2d
MD5 36bc50a83b04729ae4b9a3a637c0795f
BLAKE2b-256 a6d483fef492023e21d923507b5034b6481c9ddecf65d87702a71456c055d916

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 861756c8ee6c5ea5c8262d79a3ab10a7a584725c19771cd8a4144b72e50e1e19
MD5 7fce878d32b3b55c9b094c5e9ac4f9d4
BLAKE2b-256 bfa5c562b71bd45d0a76a64c5772ade8a10a5218d3a12ab53bb4e26c5ca89a90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c24f536704d211f38d0ec6bbe36cf7f7dce5d8f084712e30b5254b032cbe19c7
MD5 c5190fad756ef3b92f7361789ecadebf
BLAKE2b-256 c744c0acb7519b01e5026cd071273ef66a01f1eebc3416b4551ea9bb0a967bf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de3d9d94f4ccd47f046da1118eb4632927b6606efcaf6ddecb48e0efbf0be8e2
MD5 6ecb848a3f681fed52d4ff69dc48b652
BLAKE2b-256 09c4b056d5037ae964894171c081f7f5983352aad250c653a21db4c81b20c280

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 888848f7f6e324700900468200f687f52c0f081098e720093f3f5d133d56a0b0
MD5 bcab33fa89f729c7c30d4805d5396f2e
BLAKE2b-256 6456e2eca69cb88191daaaa639ce1695ec967dbe48a67b4455fb3c7f0578763c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2b8a76affaf509babe55a3358e6d71c083b5794f4bf1c699b3aa833c87e0cc3
MD5 5fa5a5a3819da2768ab6da5a8be862fc
BLAKE2b-256 39652b41cc02eefd59f08dd24faec955f0aafbd181cfdb44eaa635a3a6d7bfea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 800b5cf576caf3e0e8a9200f9fee097e9296f1a73f3bb924f3c13fe9f553f214
MD5 fa1fead6c744e1acbe37c914d9521299
BLAKE2b-256 e37adc7726d8e8e2ab67bf34906e6cfe5b5cd959858ccce383b0629c37138bcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 75784f311a54f1f0625d6b8c6978ddbd287e4936b905fb666a744102ee74104b
MD5 dd3466557d5b78e50d56900f03d6e97e
BLAKE2b-256 315680aac82c8d0499642f41e05cd5f2d9c71b4fff6f0fb7222993c04199cdcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db23b3f5d54ac0537a051e433a00389a4d1ceb7c4e2f5c613ebe93f9786472f8
MD5 5c4182a11966a962425115a83a01030f
BLAKE2b-256 ee9359535e98c21acb4f4446264ee7080a51fda46d392768d06bcc2570993d4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3d91ebedd80a4685a27ef63f7cbc259b76d47968d9d04cbffa8a7d3f7e9fb67f
MD5 048006b33c34b1b45fa79a4e0d1b4cf3
BLAKE2b-256 345f06371c82570c5585797a5993dd30217e876b02168ccde6169fcc318c8108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7633e87f6d822e48364201889ad3fe212842a0d590f0527ba5265f80d6b328ff
MD5 59c44808e26a3371b1addb8f7c81aae9
BLAKE2b-256 30b37fc62e810f0b3949ae809a6648ec2ebaa7e23f366204c8a34d5cf4ba50c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.3-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 89cb2acd85226f0a29483eadbad41896ea28e0520dcf5928ff3eeeaa3badae69
MD5 f39057350926043944048b6e4cc184b4
BLAKE2b-256 76073a3a719a87bd08000e89be33de9a12683fc2a87170a7aed46a9e48167299

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