CapyDB/ docs
Guides

Studio

A SQL runner and table browser in the dashboard, with deliberate guardrails.

SQL runner

The Studio tab on a project runs SQL against the project database with bounded execution:

  • 15 second statement timeout
  • 1000 rows maximum per result (default 200; set max_rows up to the cap)
  • 20,000 characters maximum query length

Queries run inside a transaction; results stream back as columns + rows with the executed row count. Query history is kept per project, so you can re-run the thing you wrote last Tuesday.

By default the runner is in safe mode for data work. Advanced mode unlocks DDL (CREATE/ALTER/DROP) - flip it on deliberately when you mean to change schema, not data.

For anything long-running or interactive beyond the runner's bounds, connect with psql over the direct URL - Studio is a convenience, not a replacement for a real session.

Table browser

The Tables view lists schemas and tables with row counts, lets you page through rows, and supports editing:

  • insert rows
  • update rows in place
  • delete rows

Column metadata (types, nullability, defaults) comes along, so the editor knows what it is editing.

Ask AI

The Ask AI mode turns a plain-language question ("how many orders were placed each week?") into a PostgreSQL query written against your actual schema. Nothing runs on its own: the generated SQL is shown for review, and you run it explicitly through the same bounded runner as the SQL mode. From the results you can ask for an AI-suggested chart and a section-by-section explanation of the query.

Guardrails, in order:

  • The assistant is instructed to write retrieval queries only, and refuses questions that ask it to change data or schema.
  • A generated statement that is not provably read-only will not run from the Ask AI panel - it is handed to the SQL editor for you to review and run yourself.
  • Even then, the control plane's guard against unqualified UPDATE/DELETE/TRUNCATE stays on for AI-generated statements (the SQL console's explicit opt-out does not apply here).

Included AI queries are a monthly soft cap, sized per plan: Vibe includes 50 per month, Ship 250, and Business 1,000 (UTC calendar months). Only question-to-SQL generations count - explanations and charts are free. Reaching the cap shows a notice but never blocks you; it is a fairness measure, not a paywall.

What is shared with the AI provider: your database schema (table, column, and enum names and types) when generating a query, and up to 20 sample rows of a result set when generating a chart. Full result sets stay in your browser; the assistant never gets a database connection.

From the CLI

The same bounded runner backs capydb sql:

capydb sql "select count(*) from users" --json
capydb sql "select * from orders order by created_at desc" --max-rows 50

And capydb studio opens the dashboard page for the linked project:

capydb studio --page studio

Auditing

Studio activity goes through the same control plane as everything else, so SQL execution and row mutations show up in the project audit trail.