Skip to main content

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

Project description

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"])

Project details


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.1.0.tar.gz (7.1 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.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clickhouse_arrow-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.16 Darwin/22.3.0

File hashes

Hashes for clickhouse_arrow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d59c51fba74e93fc63d2a5858dd7cf055e936d9d8f154aaaebe21dd5f1cb90e5
MD5 151da9cf1bf438c9381c7d007df78da2
BLAKE2b-256 b5cba7c9d6ab4f6928c929b02821d9d3f463ceba7cc74959a3c4c4f100d216ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clickhouse_arrow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.16 Darwin/22.3.0

File hashes

Hashes for clickhouse_arrow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5949f4eb71e4b584e59f6cae6fd455824562feaa73a5a1d41eba1b1373b3c0
MD5 2a5a60698001adfa5bf67e649d85f731
BLAKE2b-256 5c32964e961a068b23e43b1f182cc65d80e5e9dae0f9da9f238ceb592efbabe3

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