ClickHouse
ClickHouse® is a real-time analytics database management system
hypequery - The TypeScript semantic layer for ClickHouse
The analytics layer for ClickHouse.
Define your metrics once, in the codebase you already have. Dashboards, APIs, and AI agents all answer from that one definition. Run it in your own backend today. A hosted option, hypequery cloud, is coming soon.
hypequery is open source, with SDKs for TypeScript and Python. Model datasets, dimensions, and measures in code, query them by name with tenant isolation built in, then serve them as authenticated HTTP endpoints, typed React hooks, and MCP tools for agents. There's no separate BI server and no YAML project.
TypeScript quick start · Python quick start · Capabilities · Examples · MCP
import { dataset, dimension, measure } from '@hypequery/datasets'; export const Orders = dataset('orders', { source: 'orders', tenantKey: 'tenant_id', timeKey: 'created_at', dimensions: { region: dimension.string(), status: dimension.string(), createdAt: dimension.timestamp({ column: 'created_at' }), }, measures: { revenue: measure.sum('amount'), orderCount: measure.count('id'), p95OrderValue: measure.percentile('amount', 0.95), }, }); export const revenue = Orders.metric('revenue', { measure: 'revenue', });
That dataset can run in a worker, become a validated HTTP endpoint, power a typed React dashboard, or appear as a bounded MCP tool. Tenant scope and metric meaning stay in one place.
npm install -D @hypequery/cli
npx hypequery init
npx hypequery dev
Or add only the ClickHouse query builder:
npm install @hypequery/clickhouse
const revenueByRegion = await db .table('orders') .select(['region']) .where('status', 'eq', 'completed') .sum('amount', 'revenue') .groupBy('region') .orderBy('revenue', 'DESC') .execute();
No hand-written result interface. No any[]. The result is inferred from your real schema and the query itself.
The Python SDK implements the same datasets and Serve protocol, checked against the same conformance fixtures. Serve it from FastAPI, Django, Flask, or any ASGI or WSGI server.
pip install "hypequery[clickhouse]==0.1.0b2"
from hypequery.datasets import Dataset, DatasetQuery, ExecutionContext, create_dataset_client, dimension, measure, tenant from hypequery.execution import ClickHouseConnection, create_clickhouse_executor orders = Dataset( name="orders", source="orders", tenant_key="tenant_id", dimensions={"country": dimension("string")}, measures={"revenue": measure.sum("amount")}, ) analytics = create_dataset_client(executor=create_clickhouse_executor(ClickHouseConnection.from_env())) result = analytics.execute( orders, DatasetQuery(dimensions=("country",), measures=("revenue",)), context=ExecutionContext(tenant=tenant("org_123")), )
See the Python docs and python/hypequery.
FINAL, LIMIT BY, percentiles, argMax, arrays, CTEs, streaming, and window expressions.| Package | Job |
|---|---|
@hypequery/clickhouse |
Type-safe ClickHouse query builder |
@hypequery/datasets |
TypeScript semantic layer |
@hypequery/serve |
Validated analytics APIs and OpenAPI |
@hypequery/react |
Typed React hooks |
@hypequery/mcp |
Governed ClickHouse MCP server |
@hypequery/cli |
Setup, generation, local docs, and deployment |
hypequery (PyPI) |
Python datasets, execution, Serve, and CLI (beta) |
If hypequery saves you from another copied SQL string or drifting metric, a GitHub star helps the next team find it.
Apache-2.0. See LICENSE.
ClickHouse® is a real-time analytics database management system
20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。
Chat2DB is a free, cross-platform, local-first database client and SQL workspace for developers, DBAs, analysts, and data teams. Connect to 40+ databases, manage data, edit and run SQL, and use your own AI model to generate, explain, and optimize queries. Available on desktop, web, Docker, and CLI, with MCP support.
Open-source desktop SQL workspace for PostgreSQL, MySQL/MariaDB, SQLite and 15+ more databases like DuckDB, ClickHouse, Redis and Firestore. Built-in MCP server for Claude, Cursor and Devin, SQL notebooks and visual EXPLAIN.
Nouvelle version disponible.