lint_sql
Analyzes SQL strings to detect dangerous patterns, SARGability issues, and T-SQL specific errors. Returns findings with severity levels.
Instructions
Lint a SQL string with sql-sop. Catches dangerous patterns (DELETE/UPDATE without WHERE, SQL injection via string concat, DROP COLUMN, ADD NOT NULL without DEFAULT), SARGability mistakes (function on indexed column, leading-wildcard LIKE, OR across columns), 5 T-SQL specific rules (NOLOCK, xp_cmdshell, deprecated outer join, etc.), and 5 Python source rules for sqlalchemy.text() / cursor.execute() injection. 38 rules in total. Returns one JSON object listing every finding plus a human-readable summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The SQL string to lint. Can be one or many statements. | |
| disable | No | Rule IDs to skip for this call, e.g. ['W001', 'T001']. Useful when the LLM knows a specific finding is a false positive in context. | |
| severity | No | Minimum severity to report. 'error' returns only blocking issues; 'warning' returns everything (default). | warning |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||