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
| Input | Type | Required | Description |
|---|---|---|---|
question | string | yes | Plain-language question, e.g. "monthly churn by plan for 2026". |
mode | "generate" | "explain" | "optimize" | no | Generate new SQL, explain given SQL, or optimize given SQL. Default "generate". |
sql | string | for explain/optimize | The SQL statement to explain or optimize. |
tables | string[] | no | Restrict schema context to these tables. Useful for wide schemas. |
explain_plan | boolean | no | Include an execution-plan walkthrough with generated queries. Default false. |
Version history
-
v3.0.12026-09-02
- Fixed EXPLAIN output parsing on Postgres 16 (new
Settingslines broke the walker). - Added
require_where_on_deleteguardrail; DELETE without WHERE is now refused even in write mode.
- Fixed EXPLAIN output parsing on Postgres 16 (new
-
v3.0.02026-07-19
- Breaking:
explain_planoutput changed from a flat string to a structured step list. - Schema introspection now includes foreign-key relationships in context.
- Breaking:
-
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.
- Added schema caching (
-
v1.0.02025-08-01
- Initial release: generate and explain modes, Postgres and MySQL support.