Releases: bgunnarsson/binsql
Release list
binsql 3.0.0
binsql 3 is a rewrite in Rust. The terminal UI grows into a database IDE — several data sources open at once, a schema tree, tabbed query consoles and a result grid — and command mode keeps the same databases scriptable.
New
- Several data sources open at once, grouped into folders in a schema tree, with tabbed query consoles and a result grid.
Enteron a row opens it as a record, with long values wrapped and JSON re-indented. - The header says which server
⌃Rwill send the query to, so two connections both calledprodare told apart. ⌃Ccancels a running query. Postgres and MySQL are told to stop; SQL Server's connection is dropped and replaced.- The mouse: click to focus and place the cursor, double-click to open, drag to select, and drag either pane seam to resize.
- Undo and redo in the query editor, a word at a time rather than a letter.
- Project data sources: the nearest
.binsql.jsonis stacked over your own config, so a repository can carry its own. - A connection string can live in the OS credential store as
keychain://…, which⌃Ndoes by default. - The schema tree answers from a cache while it asks the server, and redraws only when the answer changed.
Command mode
query reads, exec writes, inspect describes. query refuses to write. exec runs a batch as one transaction, with --dry-run to run it and keep nothing, and needs --force for an UPDATE or DELETE without a WHERE, a DROP or a TRUNCATE. --arg binds values to ? placeholders on every database. A read-only data source refuses a write anywhere in a script — behind a comment, after a harmless first statement, or fronted by a WITH — not just in its first word.
Coming from v2
- A v2
connections.jsonopens unchanged. - The verbs are
query,execandinspect.inspectdoes whattables,describeandschemadid;count,head,connandtuiare gone, andbinsqlon its own is the TUI. - A connection string on the command line is
binsql <dsn>orbinsql --driver <name> <dsn>, no longerbinsql <driver> <dsn>, and-qgives way tobinsql query. query --max-rowsisquery --limit.- Adding a data source from the command line is not back yet; use
⌃Nin the app. - Key Vault references resolve through the Azure CLI only. Managed identity and service-principal credentials (
BINSQL_AZURE_CREDENTIAL) are not back yet, which matters for CI. - Each platform is an archive (
.tar.gz,.zipon Windows) that unpacks into a directory of its own, with achecksums.txtbeside them, rather than a bare binary.
Still to come: exporting a result, editing values in the grid, query history and filtering the tree.
2.0.1
Adds a scriptable command mode alongside the TUI, and support for Azure Key Vault connection strings.
Command mode
binsql <command> [flags] — for shell scripts, CI and coding agents.
| Command | Purpose |
|---|---|
query |
read-only queries |
exec |
writes, DDL, multi-statement scripts |
tables / describe / schema |
inspection |
count / head |
quick lookups |
conn |
saved connection profiles |
tui |
the interactive UI, now usable with --conn |
- Output as
table,json,jsonl,csv,tsv,markdown,vertical,rawornone. Data goes to stdout and status/errors to stderr; errors are JSON under-o json. Exit codes separate usage (2) from runtime (1) failures. - Driver-agnostic
?bind parameters, rewritten to$1for PostgreSQL and@p1for SQL Server. - Multi-statement scripts run in one transaction, with
--dry-runto check a migration by rolling it back. - Saved profiles in
~/.config/binsql/connections.json(mode 0600).
Guardrails
queryrefuses statements that modify the database and points atexec.execrefusesUPDATE/DELETEwithout aWHERE, andDROP/TRUNCATE, unless--force.- A
--readonlyprofile refuses every mutating statement before connecting.
Azure Key Vault
A profile can reference a secret instead of holding a connection string, so no credential is written to disk:
binsql conn add prod --dsn "keyvault://my-vault/sql-connection-string" --readonlySecrets are read with DefaultAzureCredential (az login, managed identity, or service principal) and cached encrypted for BINSQL_SECRET_TTL (default 15m; 0 disables caching). Set BINSQL_AZURE_CREDENTIAL=cli to skip the managed-identity probe that costs several seconds on a workstation.
Other changes
db.DBgainsExec,InTxandDialect; writes were previously impossible.describenow reports nullability, defaults and primary keys on all four drivers.- Table output measures display width, so non-ASCII no longer skews columns.
scripts/build.shstamps the version fromgit describe.
Compatibility
The original binsql <driver> <dsn> and binsql -q "<sql>" <driver> <dsn> forms are unchanged, including byte-identical non-interactive output.