Quarry
A ClickHouse-native query builder for TypeScript. Type-safe, explicit about ClickHouse semantics, and honest about what your driver actually returns at runtime.
Built for ClickHouse, not adapted to it
Quarry models ClickHouse concepts directly instead of pretending every database behaves like Postgres.
ClickHouse-first API
First-class FINAL, PREWHERE, SETTINGS, and JOIN semantics. No leaky abstractions over a pretend Postgres.
Runtime-honest types
execute() returns the types your driver actually produces. UInt64 is a string, Decimal is a number, no surprises.
Type-safe joins and CTEs
Column references, aliases, and selected output are all checked against your schema. Subqueries and CTEs contribute their columns to the surrounding scope.
No ORM, no magic
Just a query builder. The compiled SQL is always inspectable via toSQL(). Around 1700 lines of source you can read end-to-end.
Ready to dig in?
Get started in under five minutes, or read the architecture page to see how it all fits together.