Py-SQL-cleaner
format SQL embedded in Python strings
Details
- External ID
- 48312436
- Source
- HN
- Company
- ā
- Product
- Py-SQL-cleaner
- Website domain
- github.com
- Launched
- May 28, 2026
- Cohort
- ā
- Upvotes
- 7
- Upvotes percentile
- 0.4168012924071082
- Tags
- ā
- Fetched at
- Sept. 7, 2026, 9:26 p.m.
- Updated at
- Sept. 7, 2026, 9:26 p.m.
Description
Hi HN, I built py-sql-cleaner, a CLI for formatting SQL embedded in Python files.Python formatters handle Python syntax. They do not format SQL written inside Python code. On the other hand, SQL formatters usually target SQL files or raw SQL text, not SQL embedded inside a Python file.Still, I think it is not uncommon to find long SQL queries inside Python codebases.py-sql-cleaner detects embedded SQL inside Python files and works only on that SQL. The main things it can do are: find the SQL, format it in place, or extract it into a .sql file.It avoids rewriting SQL that depends on runtime values or template expansion. For example, SQL containing parameters like %s or :name, or Jinja-style template variables like {{ ds }}, is skipped by default.Try it with: uvx py-sql-cleaner list path/to/file.py uvx py-sql-cleaner format path/to/file.py --dry-run If you write Python, have run into this kind of SQL cleanup problem, or are just curious, Iād be happy if you take a look.
Enrichment
- Theme
- spreadsheet and tabular data tools
- Vertical
- Horizontal
- Function
- Dev tools
- Audience
- Developer
- AI stance
- Not AI
- Project type
- Hobby / open-source project
- Normalized one-liner
- sql formatter for python strings
- Manually corrected
- False
Could you build this?
Yes It is a focused CLI utility that parses Python code (likely via python's `ast` module or tree-sitter) to find SQL string literals and pass them to an existing SQL formatter library.
Discussion
No comments on this launch.
Competitors
Other products that read as similar to this one — 87 launches clear the similarity bar, closest 8 shown.
Attention rank: #40 of 88 (itself plus its competitors, highest first — normalized so YC and Product Hunt are compared fairly).
Launched 209 days after the earliest competitor.
- SQLazy · ph · 2026-09-21 · 2 upvotes · similarity 0.48
- Sqlit · hn · 2025-12-15 · 190 upvotes · similarity 0.43
- Free Online Data Formatting Tools · ph · 2026-09-16 · 1 upvotes · similarity 0.42
- QueryPad · hn · 2026-03-22 · 5 upvotes · similarity 0.41
- Data Cleaner for Notion · ph · 2026-09-25 · 1 upvotes · similarity 0.40
- SQLBraid · ph · 2026-09-18 · 1 upvotes · similarity 0.39
- Xpandas · hn · 2026-03-02 · 6 upvotes · similarity 0.39
- Bank statements converter · ph · 2026-09-21 · 1 upvotes · similarity 0.39
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a dev tools tool for Sales yet.