Start Here
Choose the right path through Quarry depending on whether you want to build a query, bootstrap DB types, or understand the deeper semantics.
Quarry is a query builder first. It is not trying to be an ORM, and it is not trying to hide ClickHouse behind a generic multi-dialect SQL abstraction.
Pick a path
- Build your first query — start in plain
TypeScript mode, connect
@clickhouse/client, and run a typedSELECT. - Bootstrap an existing DB type — generate a
plain
DBtype from ClickHouse metadata with the experimental CLI package. - Look up the exact API — jump straight to builder methods, DB entry points, and type-driven reference material.
- Read the deep-dive docs — understand runtime semantics, scope rules, ClickHouse quirks, and the architecture behind the builder.
Common jobs
- Expressions and functions — use
param(...),eb.fn.*, casts, date helpers, and predicate callbacks. - Joins — inner joins, left joins, anti joins, joined
FINALsources, and joining subqueries. - CTEs and subqueries — reusable query fragments and nested selects.
- Grouping and aggregation —
GROUP BY,HAVING,PREWHERE, aggregates, and query settings. - Inserts — batch inserts and
INSERT INTO ... SELECT. - Debugging — inspect
toSQL(), read common errors, and usetoAST()when the SQL is not enough. - Performance — practical guidance for
PREWHERE,FINAL, batch sizing,groupArray(...), andmax_threads.
Status
This package is still in early alpha. The current API is already validated against a real ClickHouse instance in integration tests, but the surface may still change before a stable release.