dbterm
v0.0.2
Published
A CLI tool for interacting with SQLite and Postgres databases, running queries, viewing tables and schemas, and saving output as JSON.
Downloads
5
Readme
dbterm
A CLI tool for interacting with SQLite and Postgres databases. Run queries, view tables and schemas, and save output as JSON files.
Features
- Connect to SQLite or Postgres
- Run SQL queries interactively
- View tables and table schemas
- Output results as table or JSON
- Save last output to a file with
save <path>;
Installation
npm install -g dbtermUsage
dbterm --type <sqlite|postgres> [options]Options
--type <type>: Database type (sqliteorpostgres)--db-path <path>: Path to SQLite database--connection <string>: Postgres connection string--output <format>: Output format (tableorjson)
Example (SQLite)
dbterm --type sqlite --db-path ./mydb.sqliteExample (Postgres)
dbterm --type postgres --connection "postgres://user:pass@localhost:5432/mydb"Commands in REPL
tables;— List all tablestable <name> schema;ordescribe <name>;— Show schema for a table- Any valid SQL statement ending with
; save <path>;— Save last output as JSON to the given pathhelp;— Show helpexit;— Exit the tool
