Open an interactive transaction; returns a handle to use with transactionQuery/transactionExecute/commitTransaction/rollbackTransaction.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
timeout_msinteger· uint64min 0
transactionobject*required
JSON wire envelope returned by `beginTransaction`.
expires_atstring· date-time*required
database::browseTable
functionRead a table page by page with typed filters and sorts, without writing SQL. Filters are structured (column, op, value) and compile to a parameterised WHERE for the driver in hand; the total honours the same filters. Use an equality filter at page_size 1 to follow a foreign key.
filtersobject[]
Combined with AND.
case_sensitiveboolean
Postgres only. Rejected elsewhere rather than silently ignored.
disabledboolean
Kept in the list but not applied. A caller refining a query wants to switch one condition off and back on without losing how it was built, and a console that only offers delete makes that a retype.
opone of*required
one of (4)
variant 1
valuestringenum: contains, not_contains, equals, not_equals, starts_with, ends_with, …
variant 2
valuestringenum: between
variant 3
valuestringenum: is_empty
variant 4
valuestringenum: in
value2unknown
Upper bound for `between`.
valuesunknown[]
Operands for `in` / `not_in`.
include_totalboolean
A filtered `COUNT(*)` is a second query and can be expensive on a large table. Turn it off while the caller is still typing.
pageinteger· uint32min 0
Zero-based.
page_sizeinteger· uint32min 0
sortobject[]
Applied in order; sort priority is position in the list.
directionall of
all of (1)
variant 1
valuestringenum: asc, desc
modeall of
all of (1)
variant 1
one of (2)
variant 1
valuestringenum: default, length, absolute_value, random
variant 2
valuestringenum: natural
nullsany of
any of (2)
variant 1
valuestringenum: first, last
timeout_msinteger· uint64min 0
has_moreboolean*required
Derived from a sentinel row, so it is correct without a count.
pageinteger· uint32*requiredmin 0
page_sizeinteger· uint32*requiredmin 0
totalinteger· int64
Total matching the same filters. Absent when not requested.
database::columnStats
functionProfile a table's columns. Reads the planner's own statistics by default, which is free and approximate; `exact` runs real aggregates and scans the table. To profile rows you already hold, pipe a browseTable result through the fp worker instead.
columnsstring[]
Omit to profile every column.
exactboolean
Run real aggregates instead of reading planner statistics. This scans the table.
timeout_msinteger· uint64min 0
approximateboolean*required
True when the numbers came from the planner rather than a count.
columnsobject[]*required
distinct_countinteger· int64
null_fractionnumber· double
sourceone of*required
one of (2)
variant 1
valuestringenum: planner
variant 2
valuestringenum: computed
top_valuesobject[]*required
Only populated in `exact` mode; the planner's own most-common-value lists are not portable enough to report faithfully.
countinteger· int64*required
Commit and finalize an interactive transaction.
transaction_idstring*required
committedboolean*required
Delete a saved query by id or by name.
idstring*required
Either the id returned by `saveQuery`, or the name it was saved under.
database::describeSchema
functionDescribe every table at once — the same shape as describeTable, but one catalog query per aspect across the whole database instead of one call per table. Use this to reason about relationships; set include_indexes only when you need them.
include_indexesboolean
Indexes cost one extra catalog query. Off by default because the common caller (a relationship diagram) only needs columns and keys.
max_tablesinteger· uintmin 0
tablesstring[]
Restrict to these tables. Omit for every table in the database.
timeout_msinteger· uint64min 0
countinteger· uint*requiredmin 0
tablesobject[]*required
columnsobject[]*required
foreign_keyany of
… expand 2 nestedcollapse
positioninteger· int32*required
1-based ordinal, as the driver reports it.
primary_keyboolean*required
typestring*required
Driver-reported type text (`TEXT`, `integer`, `varchar(255)`).
indexesobject[]*required
columnsstring[]*required
Indexed columns in ordinal order. Empty when the index is on an expression rather than plain columns.
kindstring*requiredenum: table, view
row_count_estimateinteger· int64
Planner estimate, never a `COUNT(*)`. Absent when the driver has no cheap estimate (sqlite) or has not analyzed the table yet.
truncatedboolean*required
True when `max_tables` cut the result short. Never silently truncate.
database::describeTable
functionDescribe one table or view: columns with type, nullability, default, primary-key membership and foreign-key target; plus indexes and a planner row estimate. Foreign keys are structured (schema, table, column), not a joined string.
tablestring*required
Table or view name. May be schema-qualified (`analytics.events`) on postgres; prefer the explicit `schema` field when the name itself contains a dot.
timeout_msinteger· uint64min 0
columnsobject[]*required
positioninteger· int32*required
1-based ordinal, as the driver reports it.
primary_keyboolean*required
typestring*required
Driver-reported type text (`TEXT`, `integer`, `varchar(255)`).
indexesobject[]*required
columnsstring[]*required
Indexed columns in ordinal order. Empty when the index is on an expression rather than plain columns.
kindstring*requiredenum: table, view
row_count_estimateinteger· int64
Planner estimate, never a `COUNT(*)`. Absent when the driver has no cheap estimate (sqlite) or has not analyzed the table yet.
database::execute
functionRun a write statement (INSERT/UPDATE/DELETE/DDL).
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
affected_rowsinteger· uint64*requiredmin 0
returned_rowsobject[]*required
database::executeBatch
functionRun an ordered batch of SQL statements atomically (bare strings or {sql, params} objects); rolls back on first failure.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
isolationstring
Optional: `read_committed` | `repeatable_read` | `serializable`.
statementsany of[]*required
Statements to run in order inside one transaction. Each entry is either a bare SQL string or `{ "sql": "...", "params": [...] }` — use `params` for dynamic values instead of inlining them into the SQL.
committedboolean*required
failed_indexinteger· uintmin 0
resultsobject[]
affected_rowsinteger· uint64*requiredmin 0
database::explain
functionReturn a statement's query plan as a tree with per-node costs, row estimates and warnings, instead of the driver's raw text. `analyze` collects real timings by RUNNING the statement, so it defaults to false and is refused for anything that is not a single read.
analyzeboolean
Runs the statement to collect real timings. Refused for anything that is not a read.
timeout_msinteger· uint64min 0
formatstring*requiredenum: pg_json, sqlite_query_plan, mysql_json, unknown
rawunknown
The driver's own output, so a caller is never stuck when the shape is one we do not recognise.
rootany of
any of (2)
variant 1
childrenunknown[]*required
cost_startupnumber· double
idinteger· uint32*requiredmin 0
node_classstring*requiredenum: scan, index, join, sort, aggregate, cte, …
parentinteger· uint32min 0
rows_actualnumber· double
rows_estimatednumber· double
warningsobject[]*required
kindone of*required
one of (3)
variant 1
valuestringenum: seq_scan_large
variant 2
valuestringenum: estimate_skew
variant 3
valuestringenum: nested_loop_large
node_idinteger· uint32*requiredmin 0
severitystring*requiredenum: info, warn
database::getTableView
functionHow a table is laid out for reading: column widths, hidden columns and column order. Stored in the state worker rather than a browser, so it survives a restart and any caller can set it up for someone else.
hiddenstring[]
Columns the reader has hidden. Order is not meaningful.
orderstring[]
Column display order. Names not listed keep their natural position after those that are, so adding a column to the table does not require re-saving the view.
widthsobject
Per-column pixel width. Absent means "size to content".
Live pool occupancy plus active queries, table sizes, blocking locks and cache hit ratio. Each section reports separately as available, unsupported or denied, so a driver gap or a restricted role is never mistaken for an empty result.
timeout_msinteger· uint64min 0
active_queriesone of*required
One section of the report.
one of (3)
variant 1
dataobject[]*required
… expand 5 nestedcollapse
duration_msinteger· int64
statusstring*requiredenum: available
variant 2
statusstring*requiredenum: unsupported
variant 3
statusstring*requiredenum: denied
cacheone of*required
One section of the report.
one of (3)
variant 1
dataobject*required
… expand 3 nestedcollapse
blocks_hitinteger· int64*required
blocks_readinteger· int64*required
hit_rationumber· double*required
Fraction of block reads served from cache. A healthy OLTP database usually sits well above 0.99.
statusstring*requiredenum: available
variant 2
statusstring*requiredenum: unsupported
variant 3
statusstring*requiredenum: denied
locksone of*required
One section of the report.
one of (3)
variant 1
dataobject[]*required
… expand 5 nestedcollapse
blocked_idstring*required
blocked_sqlstring*required
blocking_idstring*required
statusstring*requiredenum: available
variant 2
statusstring*requiredenum: unsupported
variant 3
statusstring*requiredenum: denied
poolobject*required
Live pool occupancy, for `database::health`.
`size` and `idle` are `None` where the underlying pool does not expose them — `mysql_async` keeps its counters private. Reporting `None` rather than zero matters: "unknown" and "no idle connections" are different answers, and a health panel that conflates them is actively misleading.
maxinteger· uint32*requiredmin 0
waitinginteger· uint32min 0
table_sizesone of*required
One section of the report.
one of (3)
variant 1
dataobject[]*required
… expand 5 nestedcollapse
index_bytesinteger· int64
row_estimateinteger· int64
total_bytesinteger· int64
statusstring*requiredenum: available
variant 2
statusstring*requiredenum: unsupported
variant 3
statusstring*requiredenum: denied
worker_versionstring*required
database::history
functionRecent queries run against a database, newest first. Best effort — recording never blocks or fails a query, so this is a convenience rather than an audit log. For an audit trail bind database::row-changed.
countinteger· uint*requiredmin 0
entriesobject[]*required
duration_msinteger· uint64min 0
row_countinteger· uintmin 0
database::listDatabases
functionList all configured databases with connection details (driver, credential-redacted URL, pool settings, TLS mode). Config only — no health checks or live pool statistics.
countinteger· uint*requiredmin 0
databasesobject[]*required
driverstring*required
"postgres" | "mysql" | "sqlite".
namestring*required
Logical key (e.g. "primary").
poolobject*required
Pool settings echoed back from config (no live stats).
acquire_timeout_msinteger· uint64*requiredmin 0
idle_timeout_msinteger· uint64*requiredmin 0
maxinteger· uint32*requiredmin 0
tlsobject*required
TLS settings. `ca_cert` is reported as a presence boolean only — never the path, which would leak filesystem layout.
ca_cert_presentboolean*required
modeone of*required
… expand 3 nestedcollapse
one of (3)
variant 1
valuestringenum: disable
variant 2
valuestringenum: require
variant 3
valuestringenum: verify-full
trust_nativeboolean*required
urlstring*required
Connection URL with credentials redacted.
List the saved queries for a database, sorted by name.
countinteger· uint*requiredmin 0
database::listTables
functionList every table and view in a database, with its kind and (on postgres) its schema. Reads the driver's own catalog, so no dialect-specific SQL is needed from the caller.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
timeout_msinteger· uint64min 0
countinteger· uint*requiredmin 0
tablesobject[]*required
kindstring*requiredenum: table, view
Internal: reload connection pools from the authoritative configuration when it changes.
idstring
Configuration id that changed (advisory; the handler re-fetches the value). Schema-only: kept to publish a typed request schema; the handler ignores it.
Prepare a parameterized statement once.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
ttl_secondsinteger· uint64min 0
handleobject*required
expires_atstring· date-time*required
Run a read-only SQL query and return the result rows.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
timeout_msinteger· uint64min 0
row_countinteger· uint*requiredmin 0
Rollback and finalize an interactive transaction.
transaction_idstring*required
rolled_backboolean*required
database::runStatement
functionRun a previously-prepared handle.
row_countinteger· uint*requiredmin 0
database::saveQuery
functionSave a named query against a database. Stored in the state worker, so it survives restarts and an agent can save one for a human to find in the console. Saving under an existing name replaces it.
database::saveTableView
functionReplace the stored layout for a table. Widths are clamped to a usable range; columns the table no longer has are kept rather than rejected, so a rename degrades to a missing width instead of an error.
hiddenstring[]
Columns the reader has hidden. Order is not meaningful.
orderstring[]
Column display order. Names not listed keep their natural position after those that are, so adding a column to the table does not require re-saving the view.
widthsobject
Per-column pixel width. Absent means "size to content".
database::schemaDiagram
functionLay out the schema as a diagram: positioned table nodes and routed foreign-key edges, plus the hub degree of each table, the isolated tables, and the remaining edge crossings. Reads the whole catalog in a handful of queries rather than one per table.
depthinteger· uintmin 0
How many foreign-key hops out from `focus` to include. Ignored without one. 1 is the table and its direct relations.
focusstring
Lay out only the neighbourhood of this table.
A whole schema drawn at once answers "what exists"; it does not answer "what does this table touch", which is the question actually being asked most of the time. With a focus the diagram becomes explorable one hop at a time instead of a wall to be scanned.
max_tablesinteger· uintmin 0
timeout_msinteger· uint64min 0
componentsobject[]*required
Connected groups, with the box that encloses each. A schema is usually several independent clusters rather than one graph, and saying so is most of what makes a large diagram readable — a reader can take in "four unrelated groups" at a glance instead of scanning for edges that are not there.
hubstring
The most-referenced table in the group, if it has more than one member.
indexinteger· uint*requiredmin 0
Stable index, in layout order.
tablesstring[]*required
Member tables, by node id.
crossingsinteger· uint32*requiredmin 0
Edge crossings remaining after ordering. Lower is a tidier diagram.
edgesobject[]*required
from_columnstring*required
pointsobject[]*required
Polyline, already routed. Anchored on the column row where the column is visible, on the node edge otherwise.
self_loopboolean*required
focusstring
Echoed when the caller asked for a neighbourhood rather than the whole schema.
frontierstring[]
Tables one hop beyond what was drawn. Non-empty means there is more to expand into, which is the difference between a diagram that looks complete and one that says where it stops.
heightnumber· double*required
isolatedstring[]*required
Tables with no foreign keys at all, placed on a trailing shelf.
nodesobject[]*required
columnsobject[]*required
foreign_keyboolean*required
primary_keyboolean*required
degreeinteger· uint32*requiredmin 0
Number of foreign keys touching this table, in or out. Renderers use it to emphasise hubs.
hidden_columnsinteger· uint*requiredmin 0
Columns not drawn because of `MAX_ROWS`.
rankinteger· uint32*requiredmin 0
truncatedboolean*required
widthnumber· double*required
database::terminateQuery
functionTerminate a backend session, or cancel just its running statement with `cancel_only`. Takes an id from database::health. Separate from health because it is a write.
cancel_onlyboolean
Ask the backend to cancel the running statement but keep the session. The default terminates the session outright.
idstring*required
Backend pid (postgres) or connection id (mysql), as reported by `database::health`.
timeout_msinteger· uint64min 0
terminatedboolean*required
database::testConnection
functionProbe a candidate database config (url + optional tls) with one throwaway connection, without touching configured pools. Reports ok/driver/latency/server version; failures are data, not errors.
timeout_msinteger· uint64min 0
Overall budget for the attempt. Default 5000, capped at 30000.
tlsany of
TLS settings to probe with. Defaults like a configured database (mode `require`) when omitted.
any of (2)
variant 1
ca_certstring
Optional path to a PEM file containing one or more CA certificates. Additive by default — these certs **extend** the system trust store rather than replace it. Set `trust_native: false` for strict-isolation deployments that must only trust the operator-supplied bundle.
modeall of
TLS mode: `disable` (plaintext), `require` (default), or `verify-full`.
… expand 1 nestedcollapse
all of (1)
variant 1
one of (3)
variant 1
valuestringenum: disable
variant 2
valuestringenum: require
variant 3
valuestringenum: verify-full
trust_nativeboolean
When true (default), the system/native trust store is loaded in addition to any `ca_cert` bundle. Set to `false` to trust only the `ca_cert` certificates — useful when an operator wants to pin trust to a private CA and explicitly *not* accept the public web PKI.
Effective for postgres. MySQL is forced-additive: `mysql_async`'s rustls path always loads the Mozilla `webpki_roots` bundle and extends it with `ca_cert` — there is no upstream knob to suppress the bundled roots, so `trust_native: false` only affects postgres.
Note: with both `trust_native: false` *and* `ca_cert: None` on postgres, no trust roots are available; pool construction fails with `CONFIG_ERROR`.
urlstring*required
Connection url to probe (`postgres://…`, `mysql://…`, `sqlite:…`).
driverstring*required
"postgres" | "mysql" | "sqlite" | "unknown".
latency_msinteger· uint64*requiredmin 0
Wall time of the whole attempt.
messagestring
Why the probe failed (credentials scrubbed). Absent on success.
okboolean*required
Whether a connection was established and answered a query.
server_versionstring
Server version string, when the probe got far enough to ask.
database::transaction
functionRun a sequence of statements atomically.
dbstring
Logical database name. Optional — omitting it targets the sole configured database, or `primary` when several are configured.
statementsobject[]*required
committedboolean*required
failed_indexinteger· uintmin 0
resultsobject[]
affected_rowsinteger· uint64*requiredmin 0
Run a write statement inside an interactive transaction. BEGIN/COMMIT/ROLLBACK are rejected; use commit/rollbackTransaction.
transaction_idstring*required
affected_rowsinteger· uint64*requiredmin 0
returned_rowsobject[]*required
Run a read-only SQL query inside an interactive transaction.
transaction_idstring*required
row_countinteger· uint*requiredmin 0
database::ui-content
functionServe the database worker's injected console UI assets (content function for its console:script / console:style triggers).
pathstring*required
The asset path from the trigger config (e.g. `state/page.js`).
contentstring*required
The asset source, verbatim.
content_typestring*required
MIME type the console should serve the asset with.