Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

sq

$ sq Community Med Risk
Neil O'Toole · Database & Data · MIT · macos / linux / windows

sq 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.

FCRS-1.0 Score
91 /100
Excellent
Medium Confidence
Zero-Friction Install
brew install sq
CLI vs MCP Decision CLI Preferred vs MCP

Queries both local files and live SQL databases with --json / --jsonl field projection, avoiding sprawling multi-table MCP schemas.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 23 / 25

First-class --json (-j), --jsonl (-J), --jsona (-A), --no-color, field projection, and structured sq inspect --json.

  • Supports --json, --jsonl, --jsona, and sq inspect --json
Trust & Safety 22 / 25

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 sql and --insert require care on live DBs
Setup & Portability 14 / 15

Single static Go binary via Homebrew, go install, and GitHub Releases on macOS, Linux, and Windows.

  • Single Go binary (brew install sq)
Utility & Efficiency 14 / 15

Bridges Postgres, MySQL, SQLite, CSV, JSON, and Excel with one uniform jq-like query syntax and cross-source --insert.

  • Unified inspect and query layer across files and RDBMS
Maintenance & Lineage 9 / 10

Actively maintained by Neil O'Toole (neilotoole/sq) under MIT license.

  • Active neilotoole/sq repository
Docs & Verifiability 9 / 10

Well-structured documentation site at sq.io/docs/ with clear flag and SLQ syntax guides.

  • Official docs at sq.io/docs/

Security, Auth & Guardrails

Auth Modes
No Auth Config File Env API Key
Credential Storage

None for local files; database source URIs and credentials are stored in ~/.config/sq/sq.yml or supplied via CLI/env.

Side Effects
Read-Only Local Write Remote Write
Cost & Quotas

MIT open-source CLI; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# 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

Inspect database or file schema as JSON
sq inspect @mydb --json

Returns table names, columns, row counts, and types as structured JSON.

Project selected columns as JSON Lines
sq '@mydb.users | .id, .email | .[0:20]' --jsonl

Queries a registered source with slice limits and streams compact JSON Lines.

Controlled Writes & Previews

Register a local SQLite or database handle
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 --json and --jsonl give 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 add stores plaintext connection strings in ~/.config/sq/sq.yml unless managed carefully.
  • ! SLQ syntax (@handle.table | .col) differs from standard SQL unless using sq sql.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI