Skip to main content

Clickhouse Arrow 🏠 🏹

A minimal ClickHouse client that uses the HTTP API and Apache Arrow.

You should probably use Clickhouse Connect instead.

Installation

pip install clickhouse_arrow

Examples

import clickhouse_arrow as ch
import pyarrow as pa

# Initialise a client
client = ch.Client("http://localhost:8123", password="password")

# Create a table
client.execute(
    """
    CREATE TABLE test (
        col1 Int64,
        col2 String
    )
    ENGINE = Memory
    """,
)

# Import a table
table = pa.Table.from_pydict(
    {
        "col1": [1, 2, 3],
        "col2": ["a", "b", "d"],
    },
)
client.insert("test", table)

# Read into a table
table = client.read_table("SELECT * FROM test")
print(table)

# Read iterator of batches
batches = client.read_batches("SELECT * FROM test")
for batch in batches:
    print(batch)

# Use query parameters
table = client.read_table(
    """
    SELECT * FROM test
    WHERE col1 = {value:Int64}
    """,
    params={"value": 2},
)
print(table)

# Use query settings
table = client.read_table(
    "SELECT col2 FROM test",
    settings={"output_format_arrow_string_as_string": 1},
)
print(table["col2"])

# Use table schema
table = client.read_table(
    "SELECT * FROM test",
    schema = pa.schema(
        [
            ("col1", pa.int64()),
            ("col2", pa.binary()),
        ]
    ),
)

Release files for clickhouse-arrow 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clickhouse-arrow 0.5.0
File Size Uploaded
clickhouse_arrow-0.5.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clickhouse-arrow 0.5.0
File Interpreter ABI Platform
clickhouse_arrow-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size:8.3 kB

Release files / clickhouse_arrow-0.5.0.tar.gz

Download URL clickhouse_arrow-0.5.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9687f834b53e7bb53fc12920da57387d5066d9f5d9cf882e14a8b26c522f921f
BLAKE2b-256 checksum
How to use checksums
d8827241aa399cf1943a002d3a343b6917c8c79224f599944adae8bd0cc8e1df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.13

Release files / clickhouse_arrow-0.5.0-py3-none-any.whl

Download URL clickhouse_arrow-0.5.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f9748bac4a75cb85eddc1b13491a40de9de952fbb1fcc13c5efe8994fc96f45
BLAKE2b-256 checksum
How to use checksums
d306c55032f765e690263db35f2c8110a8b94a3412ef43e9f7c68aa58b7b8905
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.13

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page