Quarry
Deep Dive

Overview

Background reading on Quarry's model, runtime semantics, and ClickHouse-specific design choices.

Read these pages after you already have a feel for the builder and want to know why the API looks the way it does.

  • Approach — what Quarry is and is not, and why it is not a Kysely dialect or Drizzle adapter.
  • Architecture — the four-stage pipeline from chained builder calls to ClickHouse SQL, and where to read the source if you want to go deeper.
  • Scopes and aliases — how Quarry tracks which columns are in scope at every step of a chained query, and the rules around selectAll() and column references.
  • ClickHouse quirks — a supported clauses matrix, plus the ClickHouse-specific behaviors you need to know about (LEFT JOIN nulls, PREWHERE, FINAL, typed parameters, ...).
  • Runtime semantics — the parts of ClickHouse you need to know about to read query results correctly.