SQL-Bless

Go Test License Go Reference

<English> / <Japanese>

SQL-Bless is a command-line database client similar to SQL*Plus, supporting multiple database systems.

It was designed with reliability and transparency in mind. In the past, I had to deliver an unfinished system due to client pressure, which led to serious data inconsistencies that took enormous effort to fix. That experience made me realize how important it is to have a tool that prevents silent data corruption and keeps a complete, traceable log of every operation. SQL-Bless is the result of that lesson — a tool that values safety over convenience.

image

Video by @emisjerry

Key Binding
Enter, Ctrl-M Insert a newline (or execute SQL if line ends with ; or is a short command1)
Ctrl-Enter/J Execute SQL
Ctrl-F/B Move Cursor forward or backward
Ctrl-N/P Move Cursor or refer history
Ctrl-C Exit with rollback
Ctrl-D Delete character or submit EOF (exit with rollback)
ALT-P, Ctrl-Up, PageUp Insert the previous SQL (history)
ALT-N, Ctrl-Down, PageDown Insert the next SQL (history)
TAB Table name and column name completion

Supported commands

 

Example of a spooled file

# (2023-04-17 22:52:16)
# select *
#   from tab
#  where rownum < 5
TNAME,TABTYPE,CLUSTERID
AQ$_INTERNET_AGENTS,TABLE,<NULL>
AQ$_INTERNET_AGENT_PRIVS,TABLE,<NULL>
AQ$_KEY_SHARD_MAP,TABLE,<NULL>
AQ$_QUEUES,TABLE,<NULL>
# (2023-04-17 22:52:20)
# history
0,2023-04-17 22:52:05,spool hoge
1,2023-04-17 22:52:16,"select *
  from tab
 where rownum < 5"
2,2023-04-17 22:52:20,history

Install

Download the binary package from Releases and extract the executable.

via Scoop-installer (Windows)

scoop install https://raw.githubusercontent.com/hymkor/sqlbless/master/sqlbless.json

or

scoop bucket add hymkor https://github.com/hymkor/scoop-bucket
scoop install sqlbless

Installing via Go

go install github.com/hymkor/sqlbless/cmd/sqlbless@latest

Configuration

SQL-Bless does not rely on any external configuration files. All settings—including database connection parameters, output format, and other options—are specified directly via command-line arguments.

For convenience, you can wrap frequently used connection settings in a shell script or batch file. Sample scripts for various databases are provided in this repository (see run-*.cmd). This approach ensures predictable, repeatable startup behavior without relying on hidden configuration files.

How to start

$ sqlbless {options} [DRIVERNAME] DATASOURCENAME

DRIVERNAME can be omitted when DATASOURCENAME contains DRIVERNAME.

SQLite3

$ sqlbless sqlite3 :memory:
$ sqlbless sqlite3 path/to/file.db

Oracle

$ sqlbless oracle oracle://USERNAME:PASSWORD@HOSTNAME:PORT/SERVICE
$ sqlbless oracle://USERNAME:PASSWORD@HOSTNAME:PORT/SERVICE

PostgreSQL

$ sqlbless postgres host=127.0.0.1 port=5555 user=USERNAME password=PASSWORD dbname=DBNAME sslmode=disable
$ sqlbless postgres postgres://USERNAME:PASSWORD@127.0.0.1:5555/DBNAME?sslmode=verify-full
$ sqlbless postgres://USERNAME:PASSWORD@127.0.0.1:5555/DBNAME?sslmode=verify-full

SQL Server

$ sqlbless sqlserver sqlserver://@localhost?database=master

( Windows authentication )

$ sqlbless sqlserver "Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;protocol=lpc"

MySQL

$ sqlbless.exe mysql user:password@/database

Common Options

Environment Variables

Acknowledgements

Author

hymkor (HAYAMA Kaoru)

License

MIT License


  1. DESC, EDIT, EXIT, HISTORY, HOST, QUIT, REM, SPOOL, START, \D ↩︎