Query Editor
OpsKat includes built-in consoles for every data asset type. Each type uses the interface that best fits its data model, so there is no single editor for everything:
| Asset type | Console |
|---|---|
| MySQL / PostgreSQL / SQL Server / SQLite | Shared Monaco SQL editor (described below) |
| MongoDB | Dedicated MongoDB panel — collection browser + mongosh-style query editor |
| Redis | Key browser + command console (no SQL editor) |
| etcd | Dedicated etcd panel — KV tree browser + query bar |
| Kafka | Dedicated Kafka panel — form-based broker/topic/group/ACL/schema UI |
| Object Storage | Dedicated Object Storage browser — buckets, prefixes, objects, transfers, and presigned links |
Database connections can be tunneled through SSH for secure access.
SQL Editor
The four SQL drivers — MySQL, PostgreSQL, SQL Server, and SQLite — all share the same Monaco-based SQL editor.
Connecting
Select a database asset from the sidebar and open the Query tab. If the database asset has an SSH tunnel configured, OpsKat establishes the SSH connection first and tunnels the database connection through it.
A schema/table tree on the left lets you browse databases and tables, and open a table directly in a data grid.
Writing and Executing Queries
- Write SQL in the editor with syntax highlighting and table-name auto-completion
- Press Ctrl/Cmd+Enter to execute (the selected text, or the whole editor if nothing is selected)
- Query results for
SELECT,SHOW,DESCRIBE, andEXPLAINstatements are returned as rows INSERT,UPDATE, andDELETEstatements return the number of affected rows- You can override the default database for a specific query from a dropdown
- A query history popover keeps recent statements, and SQL snippets can be inserted from your library
- Dangerous statements (
DELETE,DROP,TRUNCATE,ALTER) raise a confirmation dialog before they run
SQL Analysis
On the AI Agent and opsctl path, OpsKat uses TiDB Parser to analyze SQL before checking it against the asset's query policy. This powers:
- Statement classification — Automatically identifies the statement type (SELECT, INSERT, UPDATE, DELETE, DROP, TRUNCATE, etc.)
- Dangerous pattern detection — Flags risky operations such as:
DELETEorUPDATEwithout aWHEREclausePREPAREstatementsCALLstatements
The SQL editor on this page does not run that analysis — it only confirms DELETE, DROP, TRUNCATE, and ALTER.
Result Grid
Query results are displayed in a paginated table:
- Column headers match the query's output columns
- Page size is configurable (50 / 100 / 200 / 500 rows)
- Affected-row count is shown for
INSERT/UPDATE/DELETE - Rows can be copied out as INSERT / UPDATE statements or TSV; export to file is available when browsing a table, not for ad-hoc query results
Redis
Redis assets do not use the SQL editor. Instead they open a key browser plus a command console.
Connecting
Select a Redis asset and open the Query tab. Like databases, Redis connections can be tunneled through an SSH asset.
Key Browser
The key browser provides a visual interface for exploring Redis data:
- Browse keys in a tree (grouped by separator, default
:) or a flat list view - Filter keys with glob patterns (
SCAN-based, e.g.user:*) - Switch between databases (db0, db1, …) from the footer selector
- Open a key to view and edit its value, type, and TTL — with type-specific editors for strings, hashes, lists, sets, sorted sets, and streams
- Create and delete keys, and edit or remove TTLs
Command Console
Each key detail view includes a command input for running arbitrary Redis commands, with results formatted to the command's return type (string, integer, list, hash, nil). An Overview tab surfaces INFO server/memory/keyspace stats with optional auto-refresh.
Policy Enforcement
Policy rules govern operations issued by the AI Agent and by opsctl — an operation denied by policy is not executed, and one that needs confirmation prompts first. Policy kinds exist for SQL, Redis, MongoDB, etcd, Kafka, Kubernetes, and object storage.
The desktop consoles on this page are a different path: they are driven by you, not by an agent, and they are not policy-checked. What guards them instead:
- Confirmation dialogs — the SQL editor prompts before running
DELETE,DROP,TRUNCATE, orALTER; the other consoles confirm their own destructive actions - Read-only assets — a database asset marked read-only is opened in a read-only connection, so writes fail at the driver
If you want allow/deny enforcement on a set of statements, drive them through the AI Agent or opsctl rather than the console.