> hypequery

Query Builder API

Quick reference for the hypequery ClickHouse query builder API.

Query Builder API Reference

Use this page as a quick method index. For concepts and worked examples, use the main query-building guides.

Start Here

Core Methods

table()

db.table('users')

Starts a query from a typed table.

select()

db.table('users').select(['id', 'name', 'email'])

Chooses output columns and updates the inferred result type.

where()

db.table('users').where('status', 'eq', 'active')

Adds predicates with typed operators and values. See Where.

execute()

const rows = await db.table('users').select(['id']).execute();

Runs the query and returns typed results.

stream()

const stream = await db.table('events').stream();

Streams result batches for large datasets.

streamForEach()

await db.table('events').streamForEach(async (row) => {
  await processEvent(row);
});

Processes rows incrementally with a callback.

Join Methods

  • innerJoin()
  • leftJoin()
  • rightJoin()
  • fullJoin()

See Joins for patterns and examples.

Other Common Methods

  • groupBy()
  • having()
  • orderBy()
  • limit()
  • offset()
  • distinct()
  • settings()
  • raw()
  • rawQuery()
  • withCTE()
  • toSQL()
  • toSQLWithParams()

Use the dedicated guides above for examples and edge cases.

On this page