Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Detect Destructive SQL

database.sql_detect_destructive

ProductionEngine wrapper (Class A)Deterministicstrictmoderatev1.0.0
No network

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

Note
Flags SQL that can drop, truncate or mutate without a filter, without executing it.

Non-goals

  • Does not execute SQL
  • Does not prove a WHERE clause is selective
  • Does not authorize the caller

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysisvalidation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call2 credits

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive input, safe output
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
sqlstringYesSQL text, 1 through 2097153 characters; runtime accepts at most 2097152.
dialectstringNoPublished dialect; omit it for ANSI.
policystringNoSTRICT or BALANCED; omit it for STRICT.

Output schema

FieldTypeRequiredDescription
destructivebooleanYesTrue when at least one destructive finding or parser uncertainty was produced.
riskstringYesNONE, LOW, MEDIUM, HIGH or UNKNOWN. UNKNOWN is used when SQL could not be parsed.
findingsarrayYesDeterministically ordered closed {code, severity, path, message} findings.
policystringYesPolicy that was applied.
rulesetVersionstringYesPinned Squillify destructive-SQL ruleset identifier.
dialectstringYesDialect that was applied.
enginestringYesPinned JSqlParser Maven coordinate.

API contract

POST /v1/execute
curl
curl -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"}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
SQL_DESTRUCTIVE_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "skillKey": "database.sql_detect_destructive",
  "input": {
    "sql": "SELECT id FROM users"
  }
}

Examples

A SELECT is not destructive

Inputjson
{
  "sql": "SELECT id FROM users"
}
Expected outputjson
{
  "destructive": false,
  "risk": "NONE",
  "findings": [],
  "policy": "STRICT",
  "dialect": "ANSI",
  "engine": "com.github.jsqlparser:jsqlparser",
  "rulesetVersion": "sql-destructive-v1"
}
Tip
Reads produce risk NONE.

A DELETE without WHERE is high risk

Inputjson
{
  "sql": "DELETE FROM users"
}
Expected outputjson
{
  "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"
}
Tip
Unfiltered DELETE is DELETE_WITHOUT_FILTER.
  • Block unfiltered DELETE before a review
  • Flag DROP in a migration bundle

Avoid for

  • Authorization
  • Proving a filter is safe

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.

Tags

validationsqldatabase