Format SQL
code.format_sql
Overview
When you send SQL text, we reflow it deterministically using lexical tokenization: keyword case, clause line breaks, and optional minification. We recognize one shared keyword set rather than a vendor grammar, so we never build a parse tree or validate syntax. We never connect to a database or execute SQL — do not use this for semantic validation or dialect-perfect pretty-printing.
You should be able to clean SQL for humans to read without any execution risk. We reflow whitespace and keywords the same way every time.
Reliability
Deterministic lexical formatting; identical input yields identical output. Invalid SQL is not rejected — only whitespace and keyword case change. Oversized input throws SIZE_LIMIT_EXCEEDED — shorten the SQL before retrying.
Context footprint
Returns formatted SQL, a changed flag, statement count, and warnings. A successful call costs 1 execution credit.
When to use it
When you have SQL text and need readable or minified formatting offline.
When you need semantic validation, execution, or dialect-accurate layout.
Scope
Non-goals
- Does not run SQL
- Does not connect to databases
- Does not validate against a schema
- Does not build a parse tree or prove syntax validity
- Not a dialect-aware formatter — vendor grammar is not fully modeled
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
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 may contain submitted or transformed 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 | Exact SQL text to reflow. |
| dialect | string | No | Validated inert dialect label; omit it for generic. |
| keywordCase | string | No | Recognized-keyword case policy; omit it for upper. |
| indent | integer | No | Continuation-clause indentation; omit it for 2. |
| lineWidth | integer | No | Validated inert line-width value; omit it for 120. |
| formatMode | string | No | Pretty or minified layout; omit it for pretty. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| formatted | string | Yes | Reflowed SQL text after lexical pretty-print or minify. |
| changed | boolean | Yes | Whether the formatted text differs from the input. |
| statements | integer | Yes | Number of non-empty lexical SQL statements. |
| warnings | array | Yes | From 0 through 10 safe advisory strings; currently always empty because the formatter has no warnings. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"code.format_sql","input":{"sql":"select 1"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("code.format_sql", {"sql":"select * from users where id=1"});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. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not run SQL
- Does not connect to databases
- Does not validate against a schema
- Does not build a parse tree or prove syntax validity
- Not a dialect-aware formatter — vendor grammar is not fully modeled
- Validating SQL against a live database
- Dialect-perfect pretty-printing
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "code.format_sql",
"input": {
"sql": "select * from users where id=1"
}
}Examples
Pretty-print a simple SELECT
{
"sql": "select * from users where id=1"
}{
"changed": true,
"statements": 1,
"formatted": "SELECT *\nFROM users\nWHERE id = 1\n",
"warnings": []
}Minify removes extra line breaks
{
"sql": "select\n id\nfrom users",
"formatMode": "minify"
}{
"changed": true,
"statements": 1,
"formatted": "SELECT id FROM users;",
"warnings": []
}Recommended use cases
- Clean SQL for review or documentation
- Normalize keyword case before sharing
- Minify SQL for compact transport
Avoid for
- Validating SQL against a live database
- Dialect-perfect pretty-printing
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.