Detect Destructive SQL
database.sql_detect_destructive
Overview
You send SQL, a published dialect and STRICT or BALANCED. Findings include DROP, TRUNCATE, DELETE_WITHOUT_FILTER, UPDATE_WITHOUT_FILTER, destructive ALTER and privilege changes. An unparsed statement is never risk NONE. This does not run SQL. A successful call costs 2 execution credits.
Agents need a conservative destructive-SQL lint that cannot execute the statement.
Reliability
SQL_DESTRUCTIVE_LIMIT_EXCEEDED — trigger: more than 2 MiB or 1000 statements; retryable: no; next: split the batch.
Context footprint
SQL text is inspected only. A successful call costs 2 execution credits.
When to use it
When the caller already holds SQL and needs a drop/truncate/unfiltered-mutation check.
When authorization or a live EXPLAIN is required.
Powered by JSqlParser plus Squillify sql-destructive-v1. Unknown parse is never risk NONE.
Scope
Non-goals
- Does not execute SQL
- Does not prove a WHERE clause is selective
- Does not authorize the caller
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| sql | string | Yes | SQL text, 1 through 2097153 characters; runtime accepts at most 2097152. |
| dialect | string | No | Published dialect; omit it for ANSI. |
| policy | string | No | STRICT or BALANCED; omit it for STRICT. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| destructive | boolean | Yes | True when at least one destructive finding or parser uncertainty was produced. |
| risk | string | Yes | NONE, LOW, MEDIUM, HIGH or UNKNOWN. UNKNOWN is used when SQL could not be parsed. |
| findings | array | Yes | Deterministically ordered closed {code, severity, path, message} findings. |
| policy | string | Yes | Policy that was applied. |
| rulesetVersion | string | Yes | Pinned Squillify destructive-SQL ruleset identifier. |
| dialect | string | Yes | Dialect that was applied. |
| engine | string | Yes | Pinned JSqlParser Maven coordinate. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"database.sql_detect_destructive","input":{"sql":"DELETE FROM users"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("database.sql_detect_destructive", {"sql":"SELECT id FROM users"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| SQL_DESTRUCTIVE_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not execute SQL
- Does not prove a WHERE clause is selective
- Does not authorize the caller
- Authorization
- Proving a filter is safe
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "database.sql_detect_destructive",
"input": {
"sql": "SELECT id FROM users"
}
}Examples
A SELECT is not destructive
{
"sql": "SELECT id FROM users"
}{
"destructive": false,
"risk": "NONE",
"findings": [],
"policy": "STRICT",
"dialect": "ANSI",
"engine": "com.github.jsqlparser:jsqlparser",
"rulesetVersion": "sql-destructive-v1"
}A DELETE without WHERE is high risk
{
"sql": "DELETE FROM users"
}{
"destructive": true,
"risk": "HIGH",
"findings": [
{
"code": "DELETE_WITHOUT_FILTER",
"severity": "HIGH",
"path": "/statements/0",
"message": "DELETE has no WHERE filter."
}
],
"policy": "STRICT",
"dialect": "ANSI",
"engine": "com.github.jsqlparser:jsqlparser",
"rulesetVersion": "sql-destructive-v1"
}Recommended use cases
- Block unfiltered DELETE before a review
- Flag DROP in a migration bundle
Avoid for
- Authorization
- Proving a filter is safe
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.