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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 da4bae039f171d29ecd7cd3e363b15727a6e09346b9b57eb8534df3f0174b681
MD5 4ca21b934f02c10028d248385c01bfb7
BLAKE2b-256 dce96f0fd21a47c3c5cd07bee58e0dffc400410105d966d4a672f5f485ac1620

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f6b5f87633d8831b182b6cecd296a82f07cd7b7715fd8ab6094aa9f6de81cd6
MD5 3999f2438349efaad04f71f7fbbacaf8
BLAKE2b-256 49bffa2b0a0bc8763c55b161594ad9ef64f97c460c39c4e8a6445b02cd704d47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0771769b5499699d283945bef51bf287f83d8b3eb65e2635a6fec5274f4f4509
MD5 f84bcddc5286b670a713f6a77a301455
BLAKE2b-256 21ce2c78b3246ffca84e0c9870128fb8a3846febb249c4f325499dbb2dece9cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6df5d27b9c807debd95334d9a04c05fae9b7d20b35783dd63efefc435167e47f
MD5 0e06f4242b49025e4d462338ab1d0418
BLAKE2b-256 174adf6284b86befe0499c3a4db193ff205fb4221eca6b540eb0bd3401672d46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 034e726b7066a5283844b4348446b7de6dea9bf6352f961d0f7881227fc0dc28
MD5 f9afa854ec166fa92b725efce6fa9a1c
BLAKE2b-256 d32b68aa5d40d6bcb3d194cbc9617f673ad2d9eba0b0529ffbe6716d83cbbca8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2c59197d73f5a7d24ea3bf66fab6d521f160277d131e2b4fad4bbece2960f154
MD5 d7611ed9b64a0f4af7101c59e3f3521e
BLAKE2b-256 4240c2a0f625c9a2774e63cd38a927b0402079f7abafa48276257ffdd1057bf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c034187ef38fbe8487d54cef1b642e1a3993c9b573b8260ce600a2785e61444
MD5 6831058263a78c915cd7c45d89c98536
BLAKE2b-256 8b0ab8a8b17393d93e138f8226dfb97e2906f7bf633a1852a6dab4fd11581da6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 791e84706ce820ff7ec1260d5149c41ca6fe60340aa00e489e06142e08a367cd
MD5 04f801de55420e76a9c8b821c6b4aed8
BLAKE2b-256 a19540dc53def5a5a9807f3c0c0f3473503b5db8dea327d0f798df687298c17c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b6ce57fa7d12ce536b19629ca4057cb4b47ceaa08513ffad15fe75d26039cf1
MD5 be7f9ac4a03243463b74eb68413efc1a
BLAKE2b-256 32c6680347ea270473de1d92111cc61c21e53c6d456b5414d08db16d06dd2200

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 197a7db38fe887bc824bab81bd956109bba40ee80c4a8fb37762dcb352e93f38
MD5 a5c6df25df6423cc5f3c4468734f3148
BLAKE2b-256 5208bc4228f08448add7e6f3f97f5cd2f64c7ec315b5522960a07797e82fab99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f3b1ac33088ec150b39563257fbe9f3f292bb4dccc44bbca9a6efc82e7d3da79
MD5 f449587c3f783f551c906d90597b9674
BLAKE2b-256 c6ec5433f1d0bc599679da068d845e4cd1e27782601582ca1b511725fbe7b4f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b6ea34b53d1f6c1937b80533409954289aa4fc8ca4afadce9e4c85d23ed58aa0
MD5 5625f76313a98d7a416263d1180f5dbd
BLAKE2b-256 545fce5741f34f8eb0b8ad7950112256ffd4be3b55ca9067c59e4d4dc9540d1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 11e45ed86e3407eae59568498aac09d0208d6b315042c417e16c52e9048dd77c
MD5 9b22e08a19127a145ee14db7fad939ac
BLAKE2b-256 2f3840de43474b202c43e1b6849bc88392d28489ff7548de03aae228a58bee52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e90cda99e0e6e318faba4e873ed8313cbd5e00d3c1c9d61b5be3eaa4f762721
MD5 b4f138ec68a2152e097eeaa7ce00388e
BLAKE2b-256 abbe1bf424e9d9696b9491bdc32e166e55d7c179e2a176f2683ca7d66b3446e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 c3ea3a1b8dbfbd6573e22eb5c7ddbc14b3460de9d16283c986a69af805b52196
MD5 9cdeb39d98b464a59b81453b076a33a5
BLAKE2b-256 213c077f546c44e515e340b5c2d60890f6d0a038d85c215192bc8b64e058b605

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 006d87b97e6010ad5655b4c4f06007bb84045599460040a9c5eff0d8cdd617a3
MD5 3c7d13dce33e1edeade5db58ac3ae803
BLAKE2b-256 b80310c20db1954d6d30fb159f8c5660d9a8ee33b151b3eb7041bcc302331b2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db1f6971d490f7cc2ae2e65f7cb1cb685adc6ae0f943089a89818dda99d6f33d
MD5 6cd2322ad83739b0fe2b3e1969ea0308
BLAKE2b-256 d0fcdf6c18715665e14af83f6ed14d24cdaf9b064c8f9c34f2c7cbad51f687bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0795c78a5c3235a0c5e9a60e505ebca56d2282b231d3a9b45b46a7188652a425
MD5 e86d1fc6ee1a32f13eb66b7b5e1695a8
BLAKE2b-256 5808230562153017b029a0fb0cca280c0ac8e34fc2da30314b67b4e5dcd96f8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1074b10d725c732a073a3455619118f8c03b8d91132531c9c85411c56150ee42
MD5 f2bfacb447d5121f279bc8e079cf4255
BLAKE2b-256 07d1ef5336d4174d32c59561246185bb1199e95a94d7e83735fba2936e2ee61b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4ab76d48acc6269b73c5edef1b0ed688e189a7337a089c6280dadde6dc504d1b
MD5 3f6a52b7a0d47b791726a0d8ad622d87
BLAKE2b-256 ebdad412585d5d2a8b953874bb86424a23940019635b02a8a35e4ad952916cae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e914ee96483f302e9c95f638bb73146657237cf7daee4f16ff0d4e0a5d63e9ec
MD5 3909285af887eb8e996197877bfa57d5
BLAKE2b-256 e47e1422865339628bd8cf1de73f8539750f231089d91fd7669025a3d98d54f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7d3383aabffc4650be563dbd6d694c67a5346477770fc154f054473206c1c10
MD5 e8079c509f78aa0be68c0021b8496cce
BLAKE2b-256 15993f932a7333b33b7da53f86b1997ee008ed2c1aaa26a7be2b16481678ca8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 24a9a450bf2aafcc3c31131f4838feb7fb0052b8490602e4db9b0e5b5c36c85a
MD5 455a5387f5fcb2b8907bcd834ce339f2
BLAKE2b-256 553a42b0b5286cd1dd7546174851def15d67facf4d6d1b252492d3b1756860d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 397e6ee2e32d78f9f3934e4817185a27a55f6744560b4e53b42f8fb5af41a514
MD5 994b2b92f79d1173c59c453d1c3d5342
BLAKE2b-256 c6ee2cc98b95be1f6582dbcc522af83d6c83d6cf0d8af2e2f0fda0fec086a2a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.3.1-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 27e56d87c5cdc1fc5c49448bb2083d30763c44cd7e68412c9f31fdc4e8e0d2d7
MD5 86123f3ee8184c17f6ba7b474b53c20e
BLAKE2b-256 80a09fbe61806cb0e5b8a6bf698db7609072d6327796e8bf6737d10b921fd44d

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