Skip to Content
v1.36.0 · shipped One-screen report · Looks like your app Read the changelog →
Admin consoleSQL query
Read-only Postgres with saved queries sidebar · · open live demo ↗

SQL query

Route: /query (sidebar: SQL query, under Account)

The SQL query page in Mushi Mushi answers questions about your project’s bug data. On the Ask tab, pick Natural language to type a question in plain English, or Raw SQL to write a SELECT yourself. Every run is read-only, sandboxed and logged.

The page has four tabs: Ask, History, Schema (the approved tables) and Overview.


How it works

  1. You type a question, for example “How many P0/P1 reports landed this week vs last week?” (press Enter to run). In Raw SQL mode you write the query and press ⌘/Ctrl+Enter.
  2. Graph questions go to the graph. Questions about blast radius or dependencies are answered by walking the knowledge graph directly, without writing SQL.
  3. Otherwise the model writes SQL from a schema description of the approved tables, filtered by project_id = $1 and limited to 100 rows.
  4. The SQL is checked before it runs: one statement only, no writes or DDL (INSERT, UPDATE, DELETE, DROP, …), no system schemas (auth, storage, vault, …). A query without LIMIT gets LIMIT 100 appended. A rejected query returns INVALID_SQL.
  5. The query runs as a read-only database role (mushi_nl_reader) that can only SELECT the approved tables and only your project’s rows. That role, not the text checks, is the real boundary.
  6. You get the result rows as a table, the SQL that ran (with Copy SQL), and, for natural-language questions, a short plain-English summary.

Runs are rate-limited to 60 an hour per user; past the limit the API returns RATE_LIMITED.


Approved tables

TableWhat’s in it
reportsEvery incoming report with its classification fields
report_groupsGroups of similar reports
classification_evaluationsJudge scores for classifications
reporter_reputationReporter reputation scores
reporter_devicesDevices tracked by Spam & abuse
graph_nodes, graph_edgesThe knowledge graph
bug_ontologyBug category tags
fix_attempts, fix_verifications, fix_eventsFix runs, their verification and events
llm_invocationsEvery LLM call, with model, tokens and cost
anti_gaming_eventsFlag and unflag events

In Raw SQL mode, a query that names a table outside this list is rejected before it reaches the database. The Schema tab shows the same list.


Example questions

"Which component has the most open critical reports in the last 30 days?" "Show me the daily report volume trend for the past 3 months." "How many fix attempts failed vs. succeeded last week?" "Show reports where severity is critical and status is open, created this week."

History and saved queries

Every run, successful or not, is stored with your user, the prompt, the generated SQL, the row count and the latency. The Library panel lists them in three groups:

  • Saved: runs you pinned with Pin to Saved
  • Recent: your latest runs
  • Team: recent runs by other people on the projects you can see

You can remove a run from your history.

Results show as a table only. The page does not draw charts and has no CSV export; copy the SQL if you need the data elsewhere.


API

POST /v1/admin/query { "question": "..." } # natural language POST /v1/admin/query/raw { "sql": "SELECT ..." } # raw SQL GET /v1/admin/query/history?limit=25 PATCH /v1/admin/query/history/:id # pin / unpin DELETE /v1/admin/query/history/:id GET /v1/admin/query/team?limit=25 GET /v1/admin/query/stats

See also

Last updated on