vanna-clubpetro/test_clickhouse.py
leonardosalazar-cp 1d152c0dce Initial commit: Vanna 2.0 deployment for ClubPetro
Wrapper application around upstream Vanna with:
- Tenant-aware ChromaDB memory (per program/store)
- ClickHouse RLS runner with introspection guards
- PT-BR system prompt and chat translations
- Custom Plotly chart generator (ranked bar, datetime coercion)
- Embed bootstrap (theme pierce + i18n + markdown) shared by demo and React app
- Event sink for chat turn observability
2026-04-29 17:22:05 -03:00

28 lines
871 B
Python

"""Quick connectivity test for ClickHouse Cloud."""
import os
import clickhouse_connect
from dotenv import load_dotenv
load_dotenv()
client = clickhouse_connect.get_client(
host=os.environ["CLICKHOUSE_HOST"],
port=int(os.environ["CLICKHOUSE_PORT"]),
username=os.environ["CLICKHOUSE_USER"],
password=os.environ["CLICKHOUSE_PASSWORD"],
database=os.environ["CLICKHOUSE_DATABASE"],
secure=os.environ.get("CLICKHOUSE_SECURE", "true").lower() == "true",
)
print("Server version:", client.server_version)
print("Current database:", client.query("SELECT currentDatabase()").result_rows[0][0])
tables = client.query(
"SELECT name FROM system.tables WHERE database = currentDatabase() ORDER BY name"
).result_rows
print(f"\nTables in '{os.environ['CLICKHOUSE_DATABASE']}' ({len(tables)}):")
for (t,) in tables:
print(f" - {t}")
client.close()