DocsFeatures
Database studio
The database studio reads your Postgres, MySQL, MariaDB, SQLite and ClickHouse databases, read-only, with the schema at hand, charts of a result, and a DBA to write queries.

Add a database
- In Ops, Add a connection, paste the database's URL (
postgres://,mysql://,mariadb://,sqlite:,clickhouse://) and Fill in. Or Use a database declared in the project's repositories:.envfiles,config/database.php,prisma/schema.prisma,config/database.ymlor a Compose file. - The password goes to the vault, never in the project's file. A database on your machine is
dev, any otherprod. - A database behind a server is reached through an SSH connection of the project, with several hops if needed.
sslmodesets the encryption. - Test it. A failed check says what to do in plain words: a closed port, a refused password, an unknown host.
Query it
- Open Ops, then SQL, and pick a database in the picker at the top. No database is chosen for you.
- Schema, on the left, lists the tables in order, grouped by schema when there are several, with their columns, types, keys (primary, foreign, unique, index) and, for each foreign key, the column it points to. An open table also lists what points to it, under Referenced by. A click puts a name in the query.
- The editor completes table and column names. As you type, TermF shows the exact query that will run, or why it is refused, in plain words.
- Run it with ⌘↵. Sort the result by any column, Copy it (TSV, CSV, JSON, Markdown) or Export it (CSV, TSV, JSON, NDJSON, Markdown, SQL, Excel), up to 100,000 rows.
- Explain asks the DBA what the query does; Optimize sends it the query with its plan.
Chart a result
Table and Chart, above a result, switch between the rows and a chart.

- TermF picks the chart for you: a line along a date or a time, bars of numbers by a text, a line along a number. Id columns are left out of the series.
- Change the type (Bars, Line, Area, or Pie when it reads well: one series, a few slices, no negative value), the X axis and the Series.
- Hover a point to read its value. Export saves the chart as PNG or SVG.
The whole schema
Diagram, in the schema's header, opens on the right a diagram of every table, with its columns, types and keys, and a line for each foreign key.

- Query, above the diagram, returns to the editor.
- Search a table or a column: the others fade. Zoom with the buttons, a pinch or ⌘ and the wheel, drag to move, Fit to see everything.
- Click a table: its columns, indexes, Points to and Pointed to by (a click goes to the other table), Query this table and Ask the DBA.
Ask the DBA
Ask the DBA, next to the editor, opens its conversation on the right; it is the main button while the editor is empty. The DBA takes a request in your own words and answers with one query and a few lines. It is the same conversation as everywhere else in TermF: streamed answers, cards, images and Topic done work the same, see Ask from any screen.
- It sees the schema. It sees rows only if the connection lets agents in: each of its reads is a query you approve in TermF, with personal data masked.
- Each query it writes is checked like yours: Checked: a read, or why it is refused. Put in the editor, Run or Save it.
- One conversation per database, kept for the session. Open it in Conversations to go on.
Saved queries
Save keeps a query with its name, description, folder, tags and database, in the project's file, so it syncs with the project. Saved searches them by any of these or by their text, grouped by folder. A saved query can become a recipe: an agent then runs that query and nothing else, after your approval. Recent lists the last queries run.
Rules
- One statement:
SELECT,WITH,EXPLAINof a query,SHOWandDESCRIBEonly. A write,SELECT … INTO, a lock or a function that acts beyond reading is refused, even inside a subquery. - A read-only transaction, 15 seconds and 500 rows at most. SQLite opens the file read-only, and ClickHouse runs in its read-only mode.
- A warning when the connection's user could write: give the studio a read-only user.
- Every query, schema read and export is logged in the project's Ops history.
# the same query from a terminal
termf ops run sql-readonly --connection <name> --query <sql>