Py-SQL-cleaner streamlines embedded SQL in Python files
TL;DR. A new CLI tool, py-sql-cleaner, automates finding, formatting, and extracting SQL queries from Python strings. - The tool uses SQLGlot for SQL formatting, supporting database-specific dialects like Redshift. - It skips unsafe blocks including f-strings, Jinja-like templates, and runtime placeholders by default. - Developers can format SQL in-place, extract it to external files, or perform CI checks.
- py-sql-cleaner is a CLI tool for managing SQL embedded in Python.
- It supports in-place formatting and extraction of SQL to external files.
- The tool leverages SQLGlot for formatting, offering dialect-specific support.
- It prioritizes safety by skipping f-strings and other dynamic elements.