Skip to content

Releases: bgunnarsson/binsql

binsql 3.0.0

Choose a tag to compare

@github-actions github-actions released this 11 Sep 10:05

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. Enter on a row opens it as a record, with long values wrapped and JSON re-indented.
  • The header says which server ⌃R will send the query to, so two connections both called prod are told apart.
  • ⌃C cancels 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.json is 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 ⌃N does 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.json opens unchanged.
  • The verbs are query, exec and inspect. inspect does what tables, describe and schema did; count, head, conn and tui are gone, and binsql on its own is the TUI.
  • A connection string on the command line is binsql <dsn> or binsql --driver <name> <dsn>, no longer binsql <driver> <dsn>, and -q gives way to binsql query.
  • query --max-rows is query --limit.
  • Adding a data source from the command line is not back yet; use ⌃N in 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, .zip on Windows) that unpacks into a directory of its own, with a checksums.txt beside 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

Choose a tag to compare

@bgunnarsson bgunnarsson released this 14 Aug 10:15

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, raw or none. 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 $1 for PostgreSQL and @p1 for SQL Server.
  • Multi-statement scripts run in one transaction, with --dry-run to check a migration by rolling it back.
  • Saved profiles in ~/.config/binsql/connections.json (mode 0600).

Guardrails

  • query refuses statements that modify the database and points at exec.
  • exec refuses UPDATE/DELETE without a WHERE, and DROP/TRUNCATE, unless --force.
  • A --readonly profile 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" --readonly

Secrets 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.DB gains Exec, InTx and Dialect; writes were previously impossible.
  • describe now reports nullability, defaults and primary keys on all four drivers.
  • Table output measures display width, so non-ASCII no longer skews columns.
  • scripts/build.sh stamps the version from git describe.

Compatibility

The original binsql <driver> <dsn> and binsql -q "<sql>" <driver> <dsn> forms are unchanged, including byte-identical non-interactive output.

2.0.0

Choose a tag to compare

@bgunnarsson bgunnarsson released this 12 Dec 00:25

Full Changelog: 1.0.0...v2.0.0

1.0.0

Choose a tag to compare

@bgunnarsson bgunnarsson released this 10 Dec 21:50

Release 1.0.0