Simple SQL CLI, building upon pg and mysql CLI's with a few additional features
- One CLI for Postgres and MySQL
- Easy multiline editing of queries
- Unified command to view table schema.
DESCRIBE X - Display results in a scrollable table, no wrapping
- Need go version 1.22 or greater
- Make sure your go bin is in your path.
Easy way to add that is
export PATH="$(go env GOPATH)/bin:$PATH"
go install github.com/azvaliev/sql@latestSpecify what kind of database you're connecting to via -mysql or -psql flags (required).
For additional arguments see sql --help
sql (-mysql OR -psql) (... additional options) --database=exampleIn the query text area, type any SQL statement followed by ; and hit enter to send the query. Results will be displayed in the above space on the screen.
The text area is multi-line and you can use either the mouse or arrow keys to navigate through the text area.
Several commands from MySQL have been ported to this CLI for convinience
DESCRIBE Xcommand for easily viewing details about a table. See MySQL documentation for detailsSHOW TABLEScommand for easily all tables in the current database. It just will return a list of all tables in the current databseSHOW INDEXES FROM Xcommand for viewing indexes on a specific table.
When editing the text area, one can scroll the results section using ctrl or option (MacOS) + corresponding arrow for direction to scroll.
Example: To scroll results up, (ctrl or option) + ↑
When you run a query and it is succesfully, at the top right on the table you'll see a Copy as CSV or Copy as JSON button, to copy the table results in the desired format
Occasionally, one may want to copy the output of a particular cell in the result table, especially for use in subsequent queries.
Just click on the cell you want to copy and it will copy to the clipboard.
MySQL has an option called safe mode, you can enable this feature using the -safe flag when running this application. It helps prevent unbounded update/delete operations
See MySQL Documentation for more details




