Original Reddit post

I put together a small Python/Flask example that turns plain-English questions into SQL using Telnyx AI Inference. The app has a few endpoints: POST /query turns a question + schema into SQL POST /query/sample generates SQL and runs it against a bundled SQLite sample dataset POST /validate dry-runs SQL against the sample data GET /queries lists recent generated queries The part I wanted to focus on is guardrails. The app asks for read-only SQL, rejects multiple statements, rejects comments, and blocks write-oriented keywords like INSERT, UPDATE, DELETE, DROP, ALTER, and TRUNCATE. So the pattern is less “let an LLM run SQL” and more “let the model draft a query, then let the app validate and control what happens next.” Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/sql-natural-language-python Low Latency writeup: https://lowlatencyclub.ai/blog/posts/sql-natural-language-python.html Would love feedback from anyone building natural-language query tools or internal analytics assistants. submitted by /u/AIBotFromFuture

Originally posted by u/AIBotFromFuture on r/ArtificialInteligence