← 返回
未分类 中文

Sql Formatter

Format, minify, and lint SQL queries from the command line. Formats SQL with proper indentation and keyword casing, minifies by removing whitespace and comme...
从命令行格式化、压缩和检查 SQL 查询。 { "answer": "从命令行格式化、压缩和检查 SQL 查询。" } ``
johnnywang2001 johnnywang2001 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 433
下载
💾 10
安装
1
版本
#latest

概述

SQL Formatter

Format, minify, and lint SQL with zero dependencies.

Commands

All commands use scripts/sql_format.py.

Format SQL

python3 scripts/sql_format.py format --sql "SELECT id, name FROM users WHERE active = true"
python3 scripts/sql_format.py format --input query.sql
python3 scripts/sql_format.py format --input query.sql --output formatted.sql
python3 scripts/sql_format.py format --input query.sql --indent 4 --lowercase
echo "SELECT * FROM t" | python3 scripts/sql_format.py format --input -

Adds line breaks before major clauses (SELECT, FROM, WHERE, JOIN, ORDER BY, etc.), indents AND/OR/ON, and uppercases keywords by default.

Minify SQL

python3 scripts/sql_format.py minify --sql "SELECT  id,  name  FROM  users  -- comment"
python3 scripts/sql_format.py minify --input query.sql

Strips comments, collapses whitespace, removes unnecessary spaces around parentheses and commas.

Lint SQL

python3 scripts/sql_format.py lint --input query.sql
python3 scripts/sql_format.py lint --sql "SELECT * FROM users WHERE 1=1" --json

Checks for: SELECT *, multiple spaces, tabs, != vs <>, double commas, WHERE 1=1, long lines (>120 chars), trailing whitespace, missing semicolons, inconsistent keyword casing.

Supported SQL

Handles SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, WITH (CTEs), JOINs (all types), subqueries, string literals, double-quoted identifiers, single-line and multi-line comments.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 22:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 42,170
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 198 📥 68,306
business-ops

Agent Invoice Generator

johnnywang2001
根据自然语言或结构化数据生成专业的PDF发票,适用于用户请求创建发票、向客户计费或生成收据等场景。
★ 0 📥 765