Database (Live Tables)
client.database — list tables, TQL query, queryAll, schema, row CRUD, and detect tables from runs.
On this page7
client.database is the SDK surface for Live Tables — structured datasets written by
workflows and solutions.
Table operations
| Method | Description |
|---|---|
list(options?) | All tables |
listPage(options?) | One page |
listByWorkflow(workflowId, options?) | Tables for a workflow |
get(id, options?) | Table metadata |
getSchema(id, options?) | Column[] |
resolveByName(name, workflowId?, options?) | Lookup by name → Table | null |
detect(workflowId, workflowName?, options?) | Scan run outputs for JSONL tables |
preview(id, limit?, options?) | First N rows |
delete(id, options?) / drop(tableId, options?) | Remove table |
createLive(…) | Live table connection |
TQL query
Not SQL — filter-only TQL: column op value with AND / OR. Operators: =, !=,
>, <, ~, !~.
const result = await client.database.query(
tableId,
'severity = "critical" AND port > 443',
{
select: 'host,port,severity',
orderBy: '-_timestamp',
limit: 100,
offset: 0,
},
)
// { columns, rows, row_count, total_count?, … }| Guard | Behavior |
|---|---|
limit | Must be 1–500 per request or SDK throws ValidationError |
| SQL-shaped TQL | Rejected synchronously |
queryWithSql | Backend-gated — prefer TQL + queryAll |
Count rows
No COUNT(*). Use limit: 1 and read total_count from the response.
Stream all rows — queryAll
for await (const row of client.database.queryAll<{ host: string }>(
tableId,
'severity = "high"',
{ pageSize: 500, maxRows: 50_000 },
)) {
console.log(row.host)
}Auto-paginates with offset += pageSize until empty or maxRows reached.
Row overlay CRUD
| Method | Description |
|---|---|
listRows(tableId, …) | List overlay rows |
getRow(tableId, rowId, …) | One row |
insertRow(tableId, data, …) | Insert |
updateRow(tableId, rowId, data, …) | Update |
deleteRow(tableId, rowId, …) | Delete |
Rows include _-prefixed system fields (_id, _status, _user, …) plus dataset columns.
Types: Table, Column, QueryResult, DatasetUserRow, DetectionResult
End-to-end after a run
const table = await client.database.resolveByName('http_probe', workflowId)
if (!table) return
const page = await client.database.query(
table.id,
'status_code = 200',
{ limit: 100 },
)
for (const row of page.rows) console.log(row)