runQuery fetches rows from the workspace’s managed Postgres database using a typed filter DSL. It is the in-page data-fetching primitive: blocks like Table and KanbanBoard use it to populate themselves from live data. You declare the filter in the page document and the runtime translates it to a parameterized Postgres query server-side — raw SQL is never accepted and never exposed. By the end of this page you can wire a Table block to a schema table with filters, sort order, and cursor pagination.
Invoke from a Table block
The canonical pattern is bindingTable to a schema_table. The block calls runQuery automatically and surfaces sort, filter, and pagination through its UI.
leads-table.json
KanbanBoard uses runQuery the same way, grouping rows by a status field:
deals-kanban.json
You do not write SQL. The
filter argument is a typed DSL validated against the page’s declared schema. The runtime translates it to a parameterized Postgres query server-side — raw SQL is not accepted as input.Inputs
Outputs
Provisioning
The workspace’s managed Postgres database is auto-provisioned. Tables must be declared in the page document’sschema section before they can be queried. Schemas are managed in the Builder’s schema editor or via the pages API.
Error codes
Every error returns the standard envelope:Related
authUser
The session whose roles gate row-level access on every
runQuery call.Data queries guide
End-to-end: declare a schema, wire a Table, paginate with
next_cursor.