Zack Saadioui
8/27/2024
1
2
bash
docker pull yandex/clickhouse-server
1
docker-compose.yml
1
docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11
version: '3' services: clickhouse: image: yandex/clickhouse-server ports: - "8123:8123" # HTTP port for ClickHouse volumes: - clickhouse_data:/var/lib/clickhouse volumes: clickhouse_data:
1
2
bash
docker-compose up -d
1
2
python
from llama_index.llms.ollama import Ollama
1
2
3
python
llm = Ollama(model="your_model_name_here") # replace with your model name
database = "clickhouse://user:password@localhost:8123/default" # set the database URL for ClickHouse
1
2
bash
pip install sqlalchemy
1 2 3
from sqlalchemy import create_engine engine = create_engine(database)
1
2
bash
docker exec -it <container_id> clickhouse-client
1
2
3
4
5
6
7
sql
CREATE TABLE users (
id UInt32,
name String,
age UInt8,
email String
) ENGINE = MergeTree() ORDER BY id;
1
2
3
4
5
python
with engine.connect() as conn:
result = conn.execute("SELECT * FROM users")
for row in result:
print(row)
1
request_timeout
Copyright © Arsturn 2024