SQL static analyzer for performance, security, compliance and cost. 171 rules. Completely offline.
7.6K
SlowQL is a production-focused offline SQL static analyzer designed to catch security vulnerabilities, performance regressions, reliability issues, compliance risks, cost inefficiencies, and code quality problems before they reach production.
It performs safe static analysis of your SQL source code, requiring no database connection. SlowQL is built for modern engineering teams, supporting CI/CD pipelines, pre-commit hooks, GitHub Actions, SARIF output, and automated fixes.
pipx install slowql
pip install slowql
Requirements: Python 3.11+, Linux / macOS / Windows.
Analyze a SQL file:
slowql queries.sql
Analyze with schema validation:
slowql queries.sql --schema schema.sql
Run in CI mode with failure thresholds:
slowql --non-interactive --input-file sql/ --fail-on high --format github-actions
Preview and apply safe fixes:
slowql queries.sql --diff
slowql queries.sql --fix --fix-report fix-report.json
SlowQL can perform optional schema-aware validation by inspecting your DDL files. This allows the analyzer to catch structural issues that generic static analysis might miss.
# Pass a single DDL file
slowql queries.sql --schema database/schema.sql
# Fail CI if schema issues are found
slowql migrations/ --schema schema.sql --fail-on critical
SCHEMA-TBL-001: Table referenced but not defined in schema.SCHEMA-COL-001: Column referenced but not present in table definition.SCHEMA-IDX-001: Missing index suggested for highly-filtered column.SlowQL ships with 171 rules across six core dimensions:
| Dimension | Focus | Rules |
|---|---|---|
| Security | SQL injection, permission risks, sensitive data | 45 |
| Performance | Full scans, leading wildcards, N+1 patterns | 39 |
| Quality | Style, readability, anti-patterns | 30 |
| Cost | Inefficient cloud-warehouse patterns | 20 |
| Reliability | Null handling, data integrity, lock risks | 19 |
| Compliance | GDPR, PII handling, data sovereignty | 18 |
--input-file : Path to SQL file or directory.--schema: Path to DDL schema file.--fail-on: Set exit failure threshold (critical, high, medium, low, info, never).--non-interactive: Suppress spinners and interactive prompts.--format: Controls the primary output stream (console, github-actions, sarif).--export: Writes detailed reports to disk (json, html, csv).--out /: Directory for exported reports.0: No issues found or issues below failure threshold.2: Issues found meet or exceed the --fail-on threshold.3: Runtime error or tool failure.SlowQL automatically discovers configuration from slowql.toml, .slowql.toml, slowql.yaml, .slowql.yaml, or pyproject.toml (under [tool.slowql]).
# slowql.yaml example
severity:
fail_on: high
warn_on: medium
analysis:
dialect: postgresql
enabled_dimensions:
- security
- performance
- reliability
disabled_rules:
- PERF-SCAN-001
schema:
path: db/schema.sql
output:
format: console
verbose: false
show_fixes: true
cost:
cloud_provider: none
compliance:
frameworks:
- gdpr
- uses: makroumi/slowql-action@v1
with:
path: "./sql/**/*.sql"
schema: "db/schema.sql"
fail-on: high
format: github-actions
- name: SlowQL Analysis
run: |
pip install slowql
# Direct CLI usage with schema validation
slowql --non-interactive --input-file sql/ --schema db/schema.sql --fail-on high --format github-actions
SlowQL is designed as a modular pipeline for SQL analysis:
git clone https://github.com/makroumi/slowql.git
pip install -e ".[dev]"
# Run comprehensive test suite
pytest
# Static analysis
ruff check .
mypy src/slowql
Content type
Image
Digest
sha256:dfee212e2…
Size
6.3 MB
Last updated
3 months ago
docker pull makroumi/slowql