Connect & Query

SQL Databases

SQL mode holds your saved database connections and a query editor. It supports PostgreSQL, MySQL, SQLite, ClickHouse and Cloudflare D1. Use it to browse tables, run queries and change rows without leaving Clauge.

Connections are listed under GROUPS, the same groups you see in Workspace.

Add a connection

  1. Open SQL from the left rail.
  2. Click New Connection.
  3. Enter a Connection name and choose the Group to file it under.
  4. Pick a Driver.
  5. Fill in the fields for that driver (see below).
  6. Click Save connection.
Driver Fields Default port
PostgreSQL Host, Port, Database, Username, Password 5432
MySQL Host, Port, Database, Username, Password 3306
ClickHouse Host, Port, Database, Username, Password 8123
SQLite Database file (click Browse to pick the file) None
Cloudflare D1 Account ID, Database ID, API token (needs the D1:Edit permission) None
A SQL connection with a query and its results.

SSL and SSH tunnel

For PostgreSQL, MySQL and ClickHouse, the Advanced tab of the connection dialog has two switches:

  • Use SSL / TLS encrypts traffic between Clauge and the server.
  • Connect via SSH tunnel routes the connection through a bastion host. Pick an SSH profile saved in SSH, or click Create new SSH profile.

These switches do not apply to SQLite or Cloudflare D1.

A MySQL connection with a result grid.

Connect and browse

  1. Click a connection in the sidebar to connect.
  2. Expand it to see its databases, then the tables in each database.
  3. Right-click a row for its actions.
Right-click on Actions
Connection Connect or Disconnect, Refresh, Edit, Duplicate, Copy Connection String, Delete
Database New Query, Copy Name, Drop Database
Table SELECT TOP 100, SELECT COUNT(*), Describe Table, Copy SELECT Statement, Copy INSERT Template, Truncate Table, Drop Table

The Create Database button on a connected row creates a new database on that server.

A ClickHouse connection with a result grid.

Run a query

  1. Click + in the tab bar to open a query tab, or press Cmd/Ctrl+T.
  2. Choose the connection and database from the picker at the top of the tab.
  3. Type your SQL. Table and column names are suggested as you type.
  4. Press Cmd/Ctrl+Enter.

What runs depends on the selection:

  • With no selection, Cmd/Ctrl+Enter runs the statement the cursor is in.
  • With a selection, it runs the selected text. Several selected statements run in order, each with its own result tab.
  • The Execute button runs the selected text only. Select the query first.

While a query runs, the button changes to Cancel.

Shortcut Action
Cmd/Ctrl+Enter Run the query
Cmd/Ctrl+Shift+F Format the selection, or the whole editor if nothing is selected
Cmd/Ctrl+S Review pending row changes
Cmd/Ctrl+L Open the AI Assistant

On PostgreSQL connections you can also type psql commands such as \dt, \d table_name, \dn, \dv, \df, \du and \l. On SQLite connections .tables and .schema work.

Read and export results

Results appear in a grid under the editor. Statements that return no rows, such as an UPDATE, are listed in a Statistics tab with the affected rows, the execute time and the start and finish times.

  • Limit sets the maximum number of rows fetched. The default is 100. Enter 0 for no limit.
  • CSV exports the result to a CSV file.
  • Copy copies the whole result.
  • Right-click a cell for Copy Cell and Copy Row as JSON.

Edit rows

  1. Run a query against a single table.
  2. Double-click a cell and type the new value. To remove a row, right-click it and choose Delete Row.
  3. Click Save, or press Cmd/Ctrl+S.
  4. Check the statements listed under Review Changes.
  5. Click Execute.

Discard drops the pending changes without running anything.

A SQLite connection opened from a local database file.

AI Assistant

Press Cmd/Ctrl+L to open the AI Assistant beside the editor. It can write a query for the connected database and run it. It asks before running each query unless you turn on auto-run in the panel header. Auto-run includes queries that change or delete data.

The assistant uses the AI provider your organization set up. Its status is shown under Settings → AI.

Settings

Settings → SQL has the Connection & Query card with the defaults for SQL connections:

  • Pool Acquire Timeout (ms)
  • Pool Idle Timeout (minutes)
  • HTTP Query Timeout (s)
  • Schema Browser Limit

Timeout changes apply to new connections. Connections that are already open keep their values until you reconnect.

Organization connections

  • A connection with the Org badge is provided by your organization. You can connect and query, but you cannot edit, duplicate or delete it.
  • You can file your own connection in an organization group only if your organization allows it. If it does not, the group is greyed out in the Group list with "Turned off by your organization".
  • If your organization turns SQL off for a group, that group's connections are read-only and show "SQL is turned off for this group by your organization". If SQL is off for all your groups, it is not on the rail.

An organization database you expected but cannot see usually means you are not a member of its group. See Resources & Access.

What’s next