sq
$ sq Community Med Risksq inspects, queries, joins, and converts data across relational databases (PostgreSQL, MySQL, SQLite, SQL Server) and local files (CSV, TSV, JSON, Excel) using a unified jq-inspired pipeline syntax and --json / --jsonl output.
brew install sq Queries both local files and live SQL databases with --json / --jsonl field projection, avoiding sprawling multi-table MCP schemas.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
First-class --json (-j), --jsonl (-J), --jsona (-A), --no-color, field projection, and structured sq inspect --json.
- Supports
--json,--jsonl,--jsona, andsq inspect --json
SLQ queries are read-only by default, though sq sql and --insert can mutate registered remote databases if invoked.
- SLQ expressions are read-only;
sq sqland--insertrequire care on live DBs
Single static Go binary via Homebrew, go install, and GitHub Releases on macOS, Linux, and Windows.
- Single Go binary (
brew install sq)
Bridges Postgres, MySQL, SQLite, CSV, JSON, and Excel with one uniform jq-like query syntax and cross-source --insert.
- Unified
inspectand query layer across files and RDBMS
Actively maintained by Neil O'Toole (neilotoole/sq) under MIT license.
- Active
neilotoole/sqrepository
Well-structured documentation site at sq.io/docs/ with clear flag and SLQ syntax guides.
- Official docs at sq.io/docs/
Security, Auth & Guardrails
None for local files; database source URIs and credentials are stored in ~/.config/sq/sq.yml or supplied via CLI/env.
MIT open-source CLI; completely free.
# sq Agent Rules - Always pass `--json` or `--jsonl` and slice rows (`| .[0:20]`) or use `LIMIT` on large tables. - Run `sq inspect <source> --json` first to verify schema before querying. - Never run raw `sq sql` mutations (`INSERT`, `UPDATE`, `DROP`) or `--insert` without explicit user approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
sq inspect @mydb --json
Returns table names, columns, row counts, and types as structured JSON.
sq '@mydb.users | .id, .email | .[0:20]' --jsonl
Queries a registered source with slice limits and streams compact JSON Lines.
Controlled Writes & Previews
sq add sqlite3://./local.db --handle @local
Saves a named handle in ~/.config/sq/sq.yml for repeatable read queries.
Strengths for Agents
- +
sq inspect --jsonand--jsonlgive agents immediate schema discovery and compact streaming. - + Single Go binary connects to Postgres, MySQL, SQLite, CSV, and XLSX uniformly.
- +
jq-style column projection (| .id, .email) keeps payloads small.
Caveats & Pitfalls
- !
sq addstores plaintext connection strings in~/.config/sq/sq.ymlunless managed carefully. - ! SLQ syntax (
@handle.table | .col) differs from standard SQL unless usingsq sql.