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()),
        ]
    ),
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clickhouse_arrow-0.5.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clickhouse_arrow-0.5.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file clickhouse_arrow-0.5.0.tar.gz.

File metadata

  • Download URL: clickhouse_arrow-0.5.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.13

File hashes

Hashes for clickhouse_arrow-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9687f834b53e7bb53fc12920da57387d5066d9f5d9cf882e14a8b26c522f921f
MD5 c26a90efc820cbdfbcb74df68b554e11
BLAKE2b-256 d8827241aa399cf1943a002d3a343b6917c8c79224f599944adae8bd0cc8e1df

See more details on using hashes here.

File details

Details for the file clickhouse_arrow-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for clickhouse_arrow-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9748bac4a75cb85eddc1b13491a40de9de952fbb1fcc13c5efe8994fc96f45
MD5 d738c2e5fe11e85f2379d75eafb9fa68
BLAKE2b-256 d306c55032f765e690263db35f2c8110a8b94a3412ef43e9f7c68aa58b7b8905

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page