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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.2.2-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.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 161f7a8b7b2eed30060f02054560b4c64058391cfc00ddf2be7de4965626b757
MD5 8389209998c44d72da62b2d5ad8b4b89
BLAKE2b-256 e48facc38145928ab06889753371d32c33aab4a0aec9fc5d637a965af1422260

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 28948da815f596a116f9b6916b8aaa4ee47e6a623433892bc651a6ad357a9390
MD5 d91bbffdd7e1c18c4686e6ca73e60f33
BLAKE2b-256 a52f64c7529764ba5cca89bd9be80fc6e2ed57187082ca37940362be723dc8f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c6de7a7ada9777a1de9ccf8a7217d372256bca9e285085d03d0d04a790781be2
MD5 9544b4f7ee089f86289c72ff86ef72c8
BLAKE2b-256 0424898a819aeac9f6c9a07f1442c39a255dbd6704994446b69d20e18962663d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12ff17ed1a01f6c2d23c74e59cd84d08c0db24df191d82ee4db263dfb85ab161
MD5 64782a63bf5b61e60e1fa8dbe682331c
BLAKE2b-256 79584388098c591c1c2eaf8d4f5b1c17d8f65e87ff5aeadf87337a1423222eaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 95f933e09b56555f90371afb00f8594a65b8683828b88eadf530ebea60b0172b
MD5 e7dd5fe35d5cab7c924dc9128cd3edb3
BLAKE2b-256 eb82f48f164bf4c01ac3e606f6d650f06b532ca616379005f2f65f6664c1ab17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bc4b34c08fe43ba48a5ffd2d7afcaf970af86b427581ac292672230d57cadc35
MD5 92023b641f645c5dbe2301b1cc76a4ae
BLAKE2b-256 3f83504226cd78883b3e20bf5491481494024ee4703d028a48d8afa470ca6d93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd5d8334370df3cce2d58cf8284bf88e129aad82cc05fc1abc52435c9bf3cfda
MD5 874e16c8e6d659bc240fba42266b0e13
BLAKE2b-256 71ad942389131a1fa06436df9217bc730bf58e73cc3d8a7aae9c311f411a32f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 42c7fe92306b022c4e0eecc668d52ddd895167061b3a2251acdc642a7d1c8c3e
MD5 44bdebb2227d181336b4268010fb36c4
BLAKE2b-256 4defc57efd79701b43ce4d9e10218e29c4de21bcf830ed03a6550249cfa406fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b59094d1691e7906ea735ee24004ae71e13da2d2827645eba2d0ea8a31c62587
MD5 c81d7491d36cbd612e08303312534cfa
BLAKE2b-256 4a84a2eb5fe311decd53e01a8387e397600f09ed7cb79b71b075ba5e17fd9713

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 741e19079828154452feeb9ee8e43b75f63a5a935230df524f0a8f8ad59682bf
MD5 a6d51e5dbfb990d25662ee2bd5d56cf7
BLAKE2b-256 61ad9bf9b175d598f2edf51b63b5307724f7e2188f092db4af423a58b65df343

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 330553eca30ffc3d1810455707a7c54ca397069d87953b25eb64d4aa6dabbb88
MD5 33dd6ea556b513e68fc8644f12167e8f
BLAKE2b-256 6ada24e63b85aea5499081c0b71a76e765fac7a7d17376c9070bf833f181f5ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e8170e7e95ef872094c42404b4aebd9d82299088874fcd79c8cb925fc7679fe
MD5 67a234c774eb990ac97950a29c556da7
BLAKE2b-256 bccbf2dd88b2b52739ad9f3662b74ef9d98a97967b5b914630290cc121083d46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c6e072139eba09174db34cf82da5aad33bb722330fe2e1c9ca687944d2dd0d37
MD5 c4e27257ad72f814dda1171660245353
BLAKE2b-256 fefa7f26d951f0a04b8cb8062055af55e2690ae4945c361352bc855ca73c39f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4966c5334ed468c18912c2a1f10fe134ac164c4b6ef0f3b6c30f17f5914dc9e2
MD5 25714e3651f3d903f8516691229da132
BLAKE2b-256 a01c6593d6fe0b30d8916fc2c1456881bb4d91ab095de94a0e97568a66e0c01a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 5cf3fcf577a052cbe03fa91698ed1e1c18a05df173752bb728e0130da03a673d
MD5 7be90492bfc7119aba89e8c0ee20a118
BLAKE2b-256 c3994ed8e354e4369fba1d08430331c04bca8c266504c31588eeedf7d30cc751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 15e20fab90e5770a409dddad7ec721b93abd82ae8356a0465c60c4c386da570f
MD5 064d09b6cf67a1b85dac898500bbc0d8
BLAKE2b-256 05c3abdeddbcebe2906580ce01b1371a74cde4a7006a6347e62fc7d24a5123f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 895ba96910a7fb349e9f57d7d100184baf7c06fc495d88fad105e4d012791d8a
MD5 d1a72ac192f252499b1b6dad554a3be8
BLAKE2b-256 878954254933f1a1b14569f47d331082617f200e1465297b167569a80b970c86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c1e75b506f3a2d6141d30696bc05e9b8b3b5aebd7ddefb084f30ce2615a3668c
MD5 489486cda1784a0d1241d5545eb9dc7a
BLAKE2b-256 bc49f8bad48adef08772a7ef9fbdb5a23dfd33aa4bdb81227224a138218d0717

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79e5c454daf3de11f947a26213fc9ee5fbeb0a65a8eac4992fbe9bb21dd2ab51
MD5 b77493cc94146d7ecec6f196ecd172a5
BLAKE2b-256 5663c087504bd247fb0196533ee314dd62a79db295560343a6ae9ca22fc1f9f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 871aa36bb6d2192fae0e0e895d825f45794b71039772f418e4aa7dd83ec1e8e7
MD5 0bdf6f4253a2ba09da27e43fba35374f
BLAKE2b-256 c094715444cf8818231849c3cd4fe7c68f8deb10c329a0efbb5ed5a1f554fb7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e5f75f68d2bab408cac0a85730e7551cb8bd0357d95d80620a6ad964bef07d0d
MD5 93e46b5759491786015d7e4734285087
BLAKE2b-256 03990de9be51d806ca1b51137b48f0361858d9bbcd877ec58177119bfd510783

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c93c662500c731329d25237c6250377a2df94402329ce2de110927f1d1f6c10b
MD5 bbdc3953ff0bc8dbb352b165f02222fb
BLAKE2b-256 7c9c32fdaed3ee6e8fc87bdd4f6603b6a53888209fdfe56efbb350b3fd551a15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6e2075dac742e71846d808d414dbca424ebf36eb212f0a7ccc723ea8ad732d77
MD5 c67295f4b4ff852f25c6a2523dce2c52
BLAKE2b-256 5fdc203e9dd244430ca83f1beba2f74eeb650a2c3f5f1f0c92fde2648f2d6022

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32a767fa36431372affaf149f4654c4840cb208fec27bd987e951367749099f7
MD5 b0948533f70a80b42f87617a7ce0ac1d
BLAKE2b-256 538c721d206be15005fc62ddaa3965a86dffac816ceb2f3023773dee003a9c90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.2.2-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4147c3363c6b60239347fac105c8a3019d5595168d3e57dcd698e84f3115c409
MD5 bc1367bc4eff0c6cd77920497a507f03
BLAKE2b-256 621c0f82e296089009abbd129cb0f1199f247fef9aeaf6f6cdd7f812dd2a194c

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