LakeQL
Overview
  • Package Map
query-builder
  • Filtering
  • Sorting & Paging
  • API Reference
config
  • Runtime Config
  • API Reference
trino-client
  • Client Setup
  • Executing Queries
  • Streaming
  • Metadata
  • API Reference
fabric-client
  • Client Setup
  • Executing Queries
  • API Reference
GitHub
LakeQL
  1. Packages
  2. query-builder

query-builder

Build type-safe filters, sorting, and paging with @lakeql/query-builder.

@lakeql/query-builder turns GraphQL query intent into SQL. You give it selected fields, a filter, sorting, and paging. It produces a compiled, adapter-neutral query that the data source's dialect renders into engine-specific SQL.

You rarely call it directly. The generated query schemas use it under the hood. Knowing its inputs still helps when you write custom resolvers or debug a generated query.

1
2
3
4
5
6
7
8
9
10
11
12
13
import { generateQuery } from "@lakeql/query-builder"

const compiled = generateQuery({
  dialect,
  catalog: "hive",
  schema: "sales",
  table: "orders",
  selectFields: ["id", "status", "total"],
  userQuery: { status: { eq: "shipped" } },
  sorting: [{ field: "id", direction: "asc" }],
  paging: { limit: 20 },
})

This section covers filtering and sorting and paging. The full API reference comes at the end.

Filtering

Build WHERE conditions with the Where structure and field operators.

Sorting & Paging

Order results with SortInput and page through them with PagingInput.

API Reference

Complete reference for the @lakeql/query-builder public API.

Previous page

Package Map

Next page

Filtering