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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

native_dumper-0.3.4.0-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.4.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f54b776824cabd627e4eb445f7e9031472011517902601d3ebe0057687f49b7c
MD5 22782ae321c989fa1db67e52b8dc12e2
BLAKE2b-256 85d2a3d1c2e7b5ed9b2e3fee7846b452ecaf09717675adcfadd860d9fc171062

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 51322babb1849c62d74850256551d4d0b16812486981c3369945a90b74e82fd2
MD5 a72f1e34da8b33b2c7e43196cf2003fe
BLAKE2b-256 7380056301a8f7de723730e522fd4e05461b2d9e4d83392669a46ba1867af8ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 62118d348c5e0d7bc7b3e8c4ae1775882fe389063ae760ad5ce0f23afebef801
MD5 a98bebc1bdc9dc3a0c8a1abf1adb17bd
BLAKE2b-256 fb44404535b66a41365a4f11e3ad7b1732ef452203be317c47ebac25e95e223b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46ae424f644efad802ffa88f8127bcf945c1a6d8bac776a498a0849963dba48b
MD5 05e379ef7d20d4a630ffa661b6ba3a85
BLAKE2b-256 629c1b598ddf994f5f91e11e1b2e9f6a4e981e51e2aacd5d524ee93423b81b9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 28858f282bf892f4e1cc171f28bed397c9c4368166dc26b80301a6d80eee2dd6
MD5 766bcb93e06c758ea3fee21d475de675
BLAKE2b-256 63672d5b80f6bd49d70c8132048ebddf4bac9c84d872b4ac9932d468c27a0e89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 407caec05d73ee680a4a70d3da6cb115641b6690d1fc5f6679b49cfe87fcae6e
MD5 638769335e66b0fb618ef7c93fd043cd
BLAKE2b-256 a91947be5b6f6d6bd2834a199ec6fff0b6f0a808c36bee1744b991860ee976fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32eb03ac345c70f2cb9dadf8959c39df6491c2e50149f80bfb9921720f7681e3
MD5 b94a92177923821f7d61bc45bf70c636
BLAKE2b-256 e3df7e4a47fea0e9128259f8668c1637f854af870c48f4a63a514f37026aa1f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a80506371bd24cb96704e8832ab4aa1969b4aa1004ba618d6f8b894ee9de1cc7
MD5 c918b1ca062906391b89c80208b88c61
BLAKE2b-256 4e3cca32c13c8d68417a71059dead0f509d4d1c96599e35672d4ad099dc42d60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 beb97162317c017cdfc1872ce3578ef8fb8730eeecbd9461ad11e9c014f84c21
MD5 6132e2989b9d007f350196dad4fc97bc
BLAKE2b-256 74a44040c2d2561be329bd807b3661d75e99da0b69ea0157e0777e3e3e378990

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp313-cp313-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f5aa248e24902cd682b3f91bfea4f01331af225d49b21c64d67c2c32c15fb159
MD5 8de14cab25cf0dd75ce0ab9afd234da4
BLAKE2b-256 2867b35c834c835d94eb06cc851bf752cff49e335b8dbfde75a2d44043e11cd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0e22623430b66b54577ac199535cbc75ef933191747db4cdadb70977f7ba0bb7
MD5 e088882f39c08c3345b1bee8c28cb9d8
BLAKE2b-256 493efa725a6cd27bb7af80a7eb3057ad0ff856638f1329c91630f5b9bb5fbb20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fbf63e3448214c6a51bd527cf353ed72ad639da4e37f659018bdf004c61c8620
MD5 fa5eebbf7867b3284b4102756a7e4ed1
BLAKE2b-256 48f315dddc88d56d9a439e688fe4935172ad8fdaa53cd8c4a8310e0969be0dc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c783f5b5677bd61e5e2185e7c3153aa9fa1eae204ad36dbd6fc027cb60977a09
MD5 9fe892217a34bf12e3d8d82ad85ccc3e
BLAKE2b-256 89a7480fd62f23f726bb708d6b9327f069b0a174360e22c880857d36a868d267

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0e93e9a522802f7e536cc9d108e9f10229cf0ca21942c2ef1f72862c9c29ce1
MD5 b49277fc84e3fd33ce1769bcc3829564
BLAKE2b-256 5ab901f4f1288cbed59ac2752ec33eb3439f37075589f4926547bfb202aaf153

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 be534dad6e092654c629d73fb169e2a6b63138998365a49cb2df16dd50101556
MD5 f4e2c8a62a159e8bddd4c42bfd7e810e
BLAKE2b-256 7487b8beb566ae5ad5aa6a8514f92ad7769c1d3e5f18b7c6f1b03e8c351ada8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0253a2594990f53886b7279120052063721cab59ea50543e15e9c3abf35c88c6
MD5 2ced474706820420d8859ed0d3d892ad
BLAKE2b-256 46a67b6473789504928483bb072e6597b25ad97d486060a2bea82cb5bac1be30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9ac7e173b5a0e23acb5055b4c72776861ead4399098004acaf013a9303e7bcfb
MD5 6cbeccf936ebb67551e601471731628f
BLAKE2b-256 b53746984343aa47fa729fd7f8ab7621b375b78c3c55816051b2ebffd569d0c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5e6d4b4bf57294ed17b74d151f672dd3aa72bf3ed2926b09b320c5f62e81f185
MD5 8be50f125599c38b93c7cd946fcc811f
BLAKE2b-256 71b4e605adff1b7ca7362b951f0d6e86a07d599c24922b5f62df1b5eb96241c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 864585d2cb5acaa3ab66098ed94444eb1928c769b2a2258762a45f002952d376
MD5 f815e8438606cd896c58938b6e771e7a
BLAKE2b-256 083501ce4a47099889416af584a952d59f4cbbf3f19ad5781d3ece9fcf962897

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 94b7fcb87195d5c795f2c840d2e1d94795587c29b0ca8a7c7b466543fc97ce85
MD5 def09f2e2ace9941defdf86c40b77f73
BLAKE2b-256 d51af95242384dc8d72baa69e7714a71f49b45e7f4bd5a8c5cd0992c0902bdce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9934ddfa9fceb9d8504af460331753b1b0df57471838dd158611158329e09a25
MD5 4e8d3862806726dc8297745f6b7ff8e6
BLAKE2b-256 8abebaffabef08b2553949d8404ec1ef0106388f9131b20039053c9cb7271f3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b171aa3279f8ffe77cb20247effec4b8728a60999d4632fecdf11a932705fdb5
MD5 4b69f435546fc22c12d2d846d4ccb2ed
BLAKE2b-256 0e7e11bd8a14ecaaf083b6e1cf6066abdd2c944d59ac32eb6e325e4bcc1fc74b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 43d542f6e43b9cbdf5a0fe6fd42e3f4415344a8d89284a656c729b40db493e82
MD5 7876acaf09f174495cf4e484fe3c3f24
BLAKE2b-256 e142269ae4fe166c1ffae9cf4a48f6f4d9573c32b16f39c1889044409f8be9b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fac87cc1c5966949e338b9e3e9701ad90210509c158bd7ae1efcca64c9c021e5
MD5 02ddd273a0593d3fddef8ecc6cea2c02
BLAKE2b-256 1825ba3b3ac687973cf5efe811d07ace496377f35204db94c53cd55cd4b2d1f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for native_dumper-0.3.4.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 0d3a5aa99212fbee367e37fdb1f2c039ed8dbb1ebba4511aa26815e1d6255c9e
MD5 ecb0bcee66e9c49119d6bd13f6a37717
BLAKE2b-256 926feaa3dd67b47087324cf887f19b80583cfff0b18c2338b68f09fba850a93f

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