Metadata-Version: 2.4
Name: slowql
Version: 1.0.3
Summary: Cinematic static SQL analyzer with cyberpunk CLI
Author-email: El Mehdi Makroumi <elmehdi.makroumi@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/makroumi/slowql
Project-URL: Repository, https://github.com/makroumi/slowql
Keywords: sql,analysis,cli,performance,database
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.0
Requires-Dist: rich>=13.0.0
Requires-Dist: sqlparse>=0.4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=5.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
Dynamic: license-file

# 🔥 SlowQL - Catch Expensive SQL Before Production

**Static SQL analyzer with a cyberpunk aesthetic.** Detects 50+ performance killers, security risks, and anti-patterns before they cost you money.

---

## 🔗 Badges

### 📦 Package & Release
[![PyPI](https://img.shields.io/pypi/v/slowql?logo=pypi)](https://pypi.org/project/slowql/)
[![Release](https://img.shields.io/github/v/release/makroumi/slowql?logo=github&label=latest)](https://github.com/makroumi/slowql/releases)
[![License](https://img.shields.io/github/license/makroumi/slowql?logo=open-source-initiative)](https://github.com/makroumi/slowql/blob/main/LICENSE)

---

### 🧪 Tests & Quality
[![CI](https://github.com/makroumi/slowql/actions/workflows/ci.yml/badge.svg?logo=github)](https://github.com/makroumi/slowql/actions)
[![Coverage](https://codecov.io/gh/makroumi/slowql/branch/main/graph/badge.svg?logo=codecov)](https://codecov.io/gh/makroumi/slowql)
[![Ruff](https://img.shields.io/badge/linter-ruff-blue?logo=python)](https://github.com/charliermarsh/ruff)
[![Mypy](https://img.shields.io/badge/type_check-mypy-blue?logo=python)](http://mypy-lang.org/)
[![Tests](https://img.shields.io/badge/test_suite-pytest-blue?logo=pytest)](https://docs.pytest.org/)

---

### 🐳 Containers & Downloads
[![Docker Pulls](https://img.shields.io/docker/pulls/makroumi/slowql?logo=docker)](https://hub.docker.com/r/makroumi/slowql)
[![GHCR](https://img.shields.io/badge/GHCR-slowql-blue?logo=github)](https://github.com/makroumi/slowql/pkgs/container/slowql)
[![Downloads](https://img.shields.io/pypi/dm/slowql?logo=pypi)](https://pypistats.org/packages/slowql)


---

### 🔒 Security & Dependencies
[![Dependabot](https://img.shields.io/badge/dependabot-enabled-brightgreen?logo=dependabot)](https://github.com/makroumi/slowql/security/dependabot)
[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/makroumi/slowql?logo=snyk)](#)

---

### 📣 Community & Communication
[![Discussions](https://img.shields.io/github/discussions/makroumi/slowql?logo=github)](https://github.com/makroumi/slowql/discussions)
[![GitHub stars](https://img.shields.io/github/stars/makroumi/slowql?style=social&logo=github)](https://github.com/makroumi/slowql/stargazers)
[![Contributors](https://img.shields.io/github/contributors/makroumi/slowql?logo=github)](https://github.com/makroumi/slowql/graphs/contributors)
[![Sponsor](https://img.shields.io/github/sponsors/makroumi?logo=github)](https://github.com/sponsors/makroumi)


## ⚡ Quick Start
```bash
pip install slowql
slowql --input-file your_queries.sql
```

Or analyze queries interactively:
```bash
slowql --mode paste
```

## 🎯 What It Catches

| Severity | Issue | Impact |
|----------|-------|--------|
| 🚨 **CRITICAL** | DELETE/UPDATE without WHERE | Prevents accidental table wipes |
| 🔥 **HIGH** | Non-SARGable queries | Forces full table scans instead of index seeks |
| 🔥 **HIGH** | Leading wildcards (LIKE '%x') | Prevents index usage |
| 💫 **MEDIUM** | SELECT * usage | Unnecessary data transfer, prevents covering indexes |
| 💠 **LOW** | Unnecessary DISTINCT | Adds sorting overhead |

**50+ detectors total** covering performance, security, and maintainability.

## 📊 Example
```bash
$ slowql --input-file examples/nasty_queries.sql

╔═══════════════════════════════════════════════╗
║     SQL Analysis Results                      ║
╚═══════════════════════════════════════════════╝

Found 46 optimization opportunities
Across 21 different issue types

🚨 CRITICAL: 2
🔥 HIGH    : 8  
💫 MEDIUM  : 7
💠 LOW     : 4

🔴 CRITICAL: Missing WHERE in UPDATE/DELETE
   Query: DELETE FROM users
   Fix: Add WHERE clause or use TRUNCATE if intentional
   Impact: Can delete/update entire table accidentally
```

## 🚀 Features

- **Beautiful CLI** - Cyberpunk-themed terminal output with optional Matrix intro
- **Multiple formats** - Export to HTML, JSON, or CSV
- **CI/CD ready** - Use `--fast --non-interactive` for pipelines
- **Zero dependencies** on your database - analyzes SQL strings statically

## 📖 Usage

### Analyze a file
```bash
slowql --input-file queries.sql --export html
```

### Interactive mode
```bash
slowql
# Paste your SQL, press Ctrl+D when done
```

### CI/CD integration
```bash
slowql --input-file schema.sql --export json --fast --non-interactive
```

### Python API
```python
from slowql.core.analyzer import QueryAnalyzer

analyzer = QueryAnalyzer()
results = analyzer.analyze("SELECT * FROM users WHERE id = 1")
print(results)
```

## 🛠️ Installation

**Recommended (isolated):**
```bash
pipx install slowql
```

**Standard:**
```bash
pip install slowql
```

**From source:**
```bash
git clone https://github.com/makroumi/slowql
cd slowql
pip install -e .
```

## 🧪 Development
```bash
# Install dev dependencies
pip install -e '.[dev]'

# Run tests
pytest

# Run with coverage
pytest --cov=slowql
```

## 📝 License

Apache 2.0 - see [LICENSE](LICENSE)

## 🤝 Contributing

Issues and PRs welcome! Please run tests before submitting.

---

**Built by [@makroumi](https://github.com/makroumi)** | **[Report Issues](https://github.com/makroumi/slowql/issues)**
