dbcon

Web-based SQL console to SQLite, MySQL and Postgres.
Install
Macos Brew
brew tap vearutop/tools && brew update && brew install dbcon
Go Install
go install github.com/vearutop/dbcon@latest
$(go env GOPATH)/bin/dbcon --help
Or download binary from releases.
Linux AMD64
wget https://github.com/vearutop/dbcon/releases/latest/download/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && rm linux_amd64.tar.gz
./dbcon -version
Macos Intel
wget https://github.com/vearutop/dbcon/releases/latest/download/darwin_amd64.tar.gz && tar xf darwin_amd64.tar.gz && rm darwin_amd64.tar.gz
codesign -s - ./dbcon
./dbcon -version
Macos Apple Silicon (M1, etc...)
wget https://github.com/vearutop/dbcon/releases/latest/download/darwin_arm64.tar.gz && tar xf darwin_arm64.tar.gz && rm darwin_arm64.tar.gz
codesign -s - ./dbcon
./dbcon -version
Usage
Usage of dbcon:
dbcon [OPTIONS] DB...
DB can be a path to SQLite/CSV/JSONL file, or a URL with mysql:// or postgres:// scheme. Examples:
postgres://user:password@localhost/dbname?sslmode=disable
mysql://user:password@localhost/dbname
sqlite:///my.db
my.sqlite
my2.csv
my3.jsonl
my4.log
-auth string
basic auth as user:password
-listen string
listen address, port 0 picks a free random port (default "127.0.0.1:0")
-s skip browser opening
-tables string
comma-separated list table names to use for completion and AI
Multiple statements can be separated with ;.
If a statement has -- plot in comment, result is plotted on a chart.
First column is used for X axis, remaining columns go to Y axis.
X-axis can be a UTC datetime if values are UNIX timestamp integers and statement has a comment -- plot:time.
Use -- plot:time_axis_fmt={YYYY}-{MM} to override time axis label format (default is {HH}:{mm}\n{YYYY}-{MM}-{DD}).
Use -- plot:caption=My dataset to set a plot caption.
Use -- plot:height=360px to override plot height.
For stacked bars, add -- plot:stacked_bars. Combine with -- plot:rows for x, y, label shape or omit for x, y1, y2....
If a statement has -- plot:pie in comment, result is rendered as a pie chart.
First column is used for the numeric value of pie slice, second is a label.
Pie total is calculated as sum of all values, for cases of partial pie you can provide the total with -- plot:pie:total=123.
CSV Import/Export
-- csv:import=<file|glob> as a statement of its own imports a CSV file into a table on the
selected instance, all as TEXT columns. Paths are resolved relative to dbcon's working
directory (absolute paths and .. are rejected).
- By default the table name comes from the file name, and the first CSV row is used as header. Override with
into=table_name.
header=false treats every row as data. Combine with cols=a,b,c to name the columns, or omit cols= to reuse the columns of an already existing table.
- If the target table already exists, the import is skipped (so re-running the same query is safe), unless
header=false, cols=, or append=true is given, in which case rows are inserted into it.
- A glob, e.g.
-- csv:import=data_*.csv into=my_table, loads every match into the same table (into= is then required).
-- csv:export=<file> on a SELECT statement streams its result straight into a CSV file in dbcon's working directory, instead of returning it to the console (which reports only the row count once done). Rows are written as they come off the DB driver, without buffering the full result in memory, so this also works for selections too large to hold in memory or ship back as JSON.
AI Assistance
LLM can help to translate a query in natural language into SQL. You can enable LLM support by configuring credentials
in environment variables.
