SQLite, PostgreSQL, SQL Server and MySQL in one terminal. Several open at once, and the one marked read-only stays that way.
Get binsql
Builds for macOS, Linux and Windows. One binary, nothing else to install.
tar xzf binsql-3.0.0-darwin-arm64.tar.gz mv binsql-3.0.0-darwin-arm64/binsql /usr/local/bin
tar xzf binsql-3.0.0-linux-amd64.tar.gz mv binsql-3.0.0-linux-amd64/binsql ~/.local/bin
Expand-Archive binsql-3.0.0-windows-amd64.zip .\binsql-3.0.0-windows-amd64\binsql.exe
git clone https://github.com/bgunnarsson/binsql cd binsql && cargo build --release
northwind/prod › northwind read-only
SQL Server 2022 · nw-prod.database.windows.net
Explorer 3 ▸ sakila ▾ northwind ▾ prod mssql ▾ northwind ▾ dbo Categories Customers Employees Order Details Orders OrderID int CustomerID nchar OrderDate datetime Products Shippers ▸ local mssql ▸ scratch sqlite
Orders query 1 +
Console 4:21 1 SELECT o.OrderID, o.CustomerID, o.OrderDate, o.ShipCountry, 2 SUM(d.UnitPrice * d.Quantity) AS total 3 FROM Orders o JOIN [Order Details] d ON d.OrderID = o.OrderID 4 GROUP BY o.OrderID, o.CustomerID, o.OrderDate, o.ShipCountry
Results · 214 rows in 42ms · total decimal · 3/214 OrderID CustomerID OrderDate ShipCountry total 10248 VINET 1996-07-04 00:00:00 France 440.00 10249 TOMSP 1996-07-05 00:00:00 Germany 1863.40 10250 HANAR 1996-07-08 00:00:00 Brazil 1813.00 10251 VICTE 1996-07-08 00:00:00 France 670.80 10252 SUPRD 1996-07-09 00:00:00 Belgium 3730.00 10253 HANAR 1996-07-10 00:00:00 Brazil 1444.80 10254 CHOPS 1996-07-11 00:00:00 Switzerland 625.20 10255 RICSU 1996-07-12 00:00:00 Switzerland 2490.50 10256 WELLI 1996-07-15 00:00:00 Brazil 517.80 10257 HILAA 1996-07-16 00:00:00 Venezuela 1119.90 10258 ERNSH 1996-07-17 00:00:00 Austria 1614.88 10259 CENTC 1996-07-18 00:00:00 Mexico 100.80 10260 OTTIK 1996-07-19 00:00:00 Germany 1746.20
row 3 of 214
⇥ panes · ⌃R run · ⌃K commands · F1 help · ⌃Q quit
Engines
SQLite
./app.dbPostgreSQL
postgres://user@host:5432/dbSQL Server
server=tcp:host,1433;…MySQL and MariaDB
mysql://user@host:3306/db
What it does
- A tree of every data source, in folders that start closed. A dozen clients open to a list of a dozen clients.
- Query consoles in tabs. ⌃R runs the console, or only what is selected.
- The grid says how many rows, how long they took and the type of the column you are on.
- Enter opens a row as a record, every column stacked, long values wrapped.
- The header shows the engine and host, so two connections named prod never look the same.
- Read-only checks the whole script, not the first word, and refuses before anything reaches the server.
- Connection strings stay in the OS keychain or Azure Key Vault. connections.json holds the reference.
- ⌃C cancels on the server too: pg_cancel_backend, KILL QUERY, or a dropped connection.
Command mode
$ binsql query "SELECT TOP 3 CompanyName FROM Customers" -o csv CompanyName Alfreds Futterkiste Ana Trujillo Emparedados y helados Antonio Moreno Taquería $ binsql exec -c northwind/local -f ship.sql --dry-run UPDATE Orders SET ShippedDate = GETDATE() WHERE OrderID = 11077 — 1 row UPDATE Orders SET ShipVia = 2 WHERE OrderID IN (11076, 11075) — 2 rows (3 rows affected, rolled back — nothing was kept) $ binsql exec -c northwind/local "DELETE FROM Orders" error: refusing statement 1: DELETE with no WHERE clause changes every row — pass --force if that is what you meant
Formats
- table
- json
- jsonl
- csv
- tsv
- vertical
- markdown
- raw
Keys
- ⌃R
- Run
- ⌃C
- Cancel
- ⌃K
- Commands
- ⌃T
- New console
- ⌃N
- New data source
- ⌥1…9
- Jump to console
- F5
- Refresh
- F1
- Help
$ cargo build --releasemacOS, Linux and Windows builds are on the releases page, with checksums. Or build it with Rust 1.90.