Skip to main content

llama-index readers clickhouse integration

Project description

LlamaIndex Readers Integration: ClickHouse

Overview

ClickHouse Reader is a tool designed to retrieve documents from ClickHouse databases efficiently.

Installation

You can install ClickHouse Reader via pip:

pip install llama-index-readers-clickhouse

Usage

from llama_index.core.schema import Document
from llama_index.readers.clickhouse import ClickHouseReader

# Initialize ClickHouseReader with the connection details and configuration
reader = ClickHouseReader(
    clickhouse_host="<ClickHouse Host>",
    username="<Username>",
    password="<Password>",
    clickhouse_port=8123,  # Optional: Default port is 8123
    database="<Database Name>",
    engine="MergeTree",  # Optional: Default engine is "MergeTree"
    table="<Table Name>",
    index_type="NONE",  # Optional: Default index type is "NONE"
    metric="cosine",  # Optional: Default metric is "cosine"
    batch_size=1000,  # Optional: Default batch size is 1000
    index_params=None,  # Optional: Index parameters
    search_params=None,  # Optional: Search parameters
)

# Load data from ClickHouse
documents = reader.load_data(
    query_vector=[0.1, 0.2, 0.3],  # Query vector
    where_str=None,  # Optional: Where condition string
    limit=10,  # Optional: Number of results to return
)

This loader is designed to be used as a way to load data into LlamaIndex and/or subsequently used as a Tool in a LangChain Agent.

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

llama_index_readers_clickhouse-0.1.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page