Ferrum Marketplace

Database Runner

Vyloxi ✔ · ⬇ 0 installs · Tools

Run the selected SQL or the statement under the cursor on PostgreSQL or SQLite with the command line client, and read the result in a panel.

vyloxi.database-runner Download .fext

In Ferrum open Extensions in the sidebar, search for Database Runner and press Install. Or use Extensions: Install from File with the downloaded file.

Database Runner

Select some SQL (or just put the cursor in a statement) and press Ctrl+Alt+Enter. The query runs with the client you already have installed, and the result appears in a panel.

Engine Needs Result
PostgreSQL psql on your PATH In a panel
SQLite sqlite3 on your PATH In a panel
MySQL mysql on your PATH In the terminal only

How it works, honestly

The extension cannot read the terminal. So it writes your SQL to .ferrum/db/query.sql, types the psql or sqlite3 command in the terminal (you see it), and the client writes its output to .ferrum/db/out.txt, which the extension reads back. If the query fails, nothing arrives: the panel says so and the error is in the terminal. For MySQL there is no safe way to capture the output, so it runs in the terminal.

Safety

  • Anything that can destroy data (DROP, TRUNCATE, ALTER, or UPDATE/DELETE with no WHERE) shows the SQL and asks first.
  • The connection comes from your settings. A password inside a connection URL is typed in the terminal command: prefer a read-only database user, or a .pgpass file.
  • The settings cannot contain quotes, $ or backticks.

Handy commands: List Tables, Describe a Table..., Show the First 20 Rows, Count Rows.

Permissions

terminal, workspace.read and workspace.write (for the two files in .ferrum/db).