nowfound

Dev tools · May 28, 2026

PS

Py-SQL-cleaner – format SQL embedded in Python strings

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…

What it does

In the maker’s words, at launch

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.

Does the same job

all alternatives →
  • IS
    Inline SQL in any Python program2022 · github.com · ▲26
  • JupySQL2023 · ▲115

    JupySQL is a SQL client for Jupyter

  • SS
    SPyQL – SQL with Python in the middle2022 · github.com · ▲105

    SPyQL (https://github.com/dcmoura/spyql) is SQL with Python in the middle, an open-source project fully written in Python for making command-line data processing more intuitive, readable and powerful. Try mixing in the same pot: a SQL SELECT for providing the structure, Python expressions for defining transformations and conditions, the essence of awk as a data-processing language, and the JSON handling capabilities of jq. How does a SPyQL query looks like? $ spyql “ IMPORT pendulum AS p SELECT (p.now() - p.from_timestamp(purchase_ts)).in_days() AS days_ago, sum_agg(price…

  • Equals Import Scripts2022 · ▲337

    A spreadsheet with SQL, JavaScript, and Python built in

  • SQL Grammar2022 · ▲81

    Check if your SQL is readable or not

  • CP

More dev tools this month

the category →
  • Dograh592

    The open source VAPI alternative

    Dev tools · 25d ago · dograh.com

  • Meridian530

    Don't let your work go unnoticed. Get promoted!

    Dev tools · 20d ago · meridiona.com

  • x1516

    Lovable for iPhone apps go from idea to App Store

    Dev tools · 11d ago · x1.new

  • Open-source GTM skills for technical founders

    Dev tools · 29d ago · gtmcofounder.com

  • Nuphos380

    The AI-Native DevOps Workspace.

    Dev tools · 24d ago · nuphos.ai

  • OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.

    Dev tools · 1d ago · opentrailpaper.com

Launched alongside, May 2026

the whole month →
  • Brew 905

    Like Claude design for email marketing

    AI · May 2026 · brew.new

  • Parallel agents, diff reviewer, and multi-model comparisons

    Dev tools · May 2026 · kilo.ai

  • StoreClaw805

    Grow your store profits with agents that know how to sell

    AI · May 2026 · storeclaw.ai

  • Give your agent a real number and voice to make calls.

    AI · May 2026 · pollyreach.ai

  • NW

    Hey HN, Henry here from Cactus. We open-sourced Needle, a 26M parameter function-calling (tool use) model. It runs at 6000 tok/s prefill and 1200 tok/s decode on consumer devices. We were always frustrated by the little effort made towards building agentic models that run on budget phones, so we conducted investigations that led to an observation: agentic experiences are built upon tool calling, and massive models are overkill for it. Tool calling is fundamentally retrieval-and-assembly (match query to tool name, extract argument values, emit JSON), not reasoning. Cross-attention…

    Life & fun · May 2026 · github.com

  • FM

    Dev tools · May 2026 · github.com