AI-Written SQL (and Stored Procedures) from "Works" to "Trusted"
AI-Written SQL (and Stored Procedures) from "Works" to "Trusted"
This article argues that AI's cheap SQL generation has not reduced review cost, since direct natural-language-to-SQL for complex queries is roughly 60% accurate and models cannot flag their own errors. It proposes demoting the model to a planner that emits linear, plain-language step scripts (filter, sort, segment, summarize), which a deterministic compiler (SQLazy) turns into dialect-specific SQL, making evaluation order match reading order and enabling step-level debugging. It also covers reverse-translating legacy SQL and stored procedures into auditable scripts, embedding SQLazy fragments in host procedures or SPL, and comparing this with conventional AI translation loops.
Source: Hacker News AI · github.com