sql-assistant

v3.0.1 MCP-compatible datadevtools MIT updated 2026-09-02

Generate, explain, and optimize SQL from plain-language questions. Introspects your schema once, caches it, and applies guardrails — read-only by default, with explicit confirmation for anything that writes.

Installation

$ skillbank install sql-assistant@3.0.1
# then point it at a database (read-only role recommended)

Configuration

# sql-assistant.config.yaml
connection:
  dsn: "postgresql://reader:***@db.internal:5432/analytics"
  schema_cache_ttl: 3600     # seconds; re-introspect hourly
guardrails:
  read_only: true            # reject INSERT/UPDATE/DELETE/DDL
  require_where_on_delete: true
  max_rows: 10000
dialect_hints:
  - "prefer CTEs over subqueries"
safetyKeep read_only: true unless you have a reason not to. The skill refuses destructive statements unless the guardrail is explicitly disabled and a confirmation token is passed.

Inputs

InputTypeRequiredDescription
questionstringyesPlain-language question, e.g. "monthly churn by plan for 2026".
mode"generate" | "explain" | "optimize"noGenerate new SQL, explain given SQL, or optimize given SQL. Default "generate".
sqlstringfor explain/optimizeThe SQL statement to explain or optimize.
tablesstring[]noRestrict schema context to these tables. Useful for wide schemas.
explain_planbooleannoInclude an execution-plan walkthrough with generated queries. Default false.

Version history

  1. v3.0.12026-09-02
    • Fixed EXPLAIN output parsing on Postgres 16 (new Settings lines broke the walker).
    • Added require_where_on_delete guardrail; DELETE without WHERE is now refused even in write mode.
  2. v3.0.02026-07-19
    • Breaking: explain_plan output changed from a flat string to a structured step list.
    • Schema introspection now includes foreign-key relationships in context.
  3. v2.2.02026-04-11
    • Added schema caching (schema_cache_ttl) so repeated questions don't re-introspect.
    • Fixed MySQL backtick quoting in generated JOIN aliases.
  4. v1.0.02025-08-01
    • Initial release: generate and explain modes, Postgres and MySQL support.

← back to catalog