SQLazy–Deterministic SQL Generation SQLazy launches a deterministic SQL generation tool that lets users write complex queries step-by-step in natural language, then compiles them into auditable, production-ready SQL. The compiler guarantees no AI hallucinations, and the workflow supports debugging and multi-database portability. The tool is available as a web app and a desktop IDE. Write complex SQL step-by-step in natural language β€” then compile it into auditable, production-ready SQL. AI-assisted. Compiler-guaranteed. No black boxes. MIT License for examples β€’ SQLazy application is proprietary Writing analytical SQL is hard. Reviewing AI-generated SQL is even harder. Modern AI can produce SQL that runs β€” but you never know whether you can trust it. When queries become deeply nested with window functions and subqueries, they become: - hard to review - hard to debug - hard to maintain - hard to port across databases SQLazy turns SQL development into a step-by-step workflow you can actually understand and audit. Instead of generating one giant SQL statement, SQLazy lets you: - Describe each step in semi-natural language - Verify the logic step-by-step - Compile the steps into native SQL The final SQL is generated by a compiler , not an LLM. That means: - No AI hallucinations in the final SQL - Fully auditable logic - Production-ready output AI helps you write the steps , not the final SQL. You review the logic first. Then the compiler gives you the trustworthy the SQL. Result: AI productivity + compiler reliability. Even the most complex analytics queries become simple building blocks: - calculate - filter - summarize - group - join - rank - segment ... No more nested SQL nightmares. Debugging complex SQL is painful. You usually can't inspect intermediate results. SQLazy provides step-by-step execution so you can see: - intermediate tables - intermediate calculations - intermediate filters Exactly like debugging code. Write your logic once. Generate SQL for multiple databases. No more rewriting queries for different SQL dialects. LLMs help you: - rewrite messy natural language into SQLazy steps - decompose complex requirements into workflows But you stay in control of the logic. Instead of writing one large SQL statement, the logic is expressed as a step-by-step workflow. Each step represents a single transformation. | Variable | Anchor | Statement | |---|---|---| | t1 | stock | filter CODE = 100046 | | t2 | sort DT asc | | | t3 | segment CL down as NoRisingDays | | | t4 | summarize DT count as ContinuousDays group NoRisingDays | | | summarize ContinuousDays max as max ContinuousDays | This workflow is easy to read and easy to review. Each step does only one simple thing . WITH t2 AS SELECT CODE, DT, CL FROM stock WHERE CODE = 100046 SELECT MAX ContinuousDays AS max ContinuousDays FROM SELECT NoRisingDays, COUNT DT AS ContinuousDays FROM SELECT CODE, DT, CL, SUM CASE WHEN CL < col 3 THEN 1 ELSE 0 END OVER ORDER BY DT ASC + 1 AS NoRisingDays FROM SELECT t2. , LAG CL OVER ORDER BY DT ASC AS col 3 FROM t2 sub 4 t3 GROUP BY NoRisingDays t4 This SQL is: - deeply nested - hard to review - hard to debug - hard to modify But the SQLazy workflow is easy to read, review, and audit. 🌐 Try the Web App: https://sqlazy.com https://sqlazy.com - online playground - free usage limited compute - perfect for quick experiments & sharing Best for daily work and large datasets. Features: - unlimited local debugging - bring your own LLM key - customizable prompts - full performance | Feature | Web App sqlazy.com | Desktop IDE | |---|---|---| | Natural language β†’ SQL | βœ… Full SQL generation capabilities | βœ… Full SQL generation + native SPL generation | | AI assistance & planning | βœ… Usage-limited hosted LLM | βœ… Bring your own LLM key, no usage limits, customizable prompts | | Step-by-step debugging | βœ… Limited dataset size | βœ… Powered by esProc engine, supports large datasets | | Data stays in your environment | ❌ Runs in the cloud | βœ… Supports private/on-prem deployment commercial license | | Interface & language support | English UI and terminology | Full English + Chinese UI and terminology | | Database dialect support | Same core compiler | Same core compiler | | Availability | Free | Free for personal & team online use; commercial license for private/on-prem deployment | | Version control | Always up-to-date in the cloud | Free edition auto-updates; commercial edition supports version locking | We collected real SQL problems from the Internet and solved them step-by-step with SQLazy. These examples show how complex analytical queries can be expressed as clear, auditable workflows. Explore the examples by real analytics scenarios: Detect continuous patterns in time-series data – one of the hardest problems to solve with standard SQL. - Find the longest consecutive rising streak for a single stock - Get the exact start and end dates of the longest rising period - Filter all stocks with rising streaks longer than N days - Extract every rising streak period that exceeds 3 days πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/consecutive-trends https://github.com/SPLWare/sqlazy/tree/master/examples/consecutive-trends Split event streams into logical sessions and generate sequence numbers based on time gaps or state changes. - Number events and reset counters when time gaps exceed 1 hour - Create conditional running totals that reset when a condition is met πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/event-sequencing https://github.com/SPLWare/sqlazy/tree/master/examples/event-sequencing Dynamic grouping based on data values and running status – eliminates complex SUM CASE WHEN ... OVER ... patterns. - Calculate totals differently for single-customer vs multi-customer groups - Group records automatically when a running status flag changes πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/conditional-grouping https://github.com/SPLWare/sqlazy/tree/master/examples/conditional-grouping Rolling window calculations and interval aggregations with automatic missing value backfilling. - Build minute-by-minute price bars OHLC with gap filling - Calculate 5-minute rolling totals over time-series data πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/time-window-analytics https://github.com/SPLWare/sqlazy/tree/master/examples/time-window-analytics Prepare messy datasets for reporting and analytics with simple, readable steps. - Hide repeated values in reports replace duplicates with NULL - Generate status flags based on recent consecutive row values πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/data-cleaning https://github.com/SPLWare/sqlazy/tree/master/examples/data-cleaning Add, modify or inject rows into grouped results without complex union operations. - Insert a header row before each group of records - Split total amounts across multiple rows while preserving the grand total πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/group-enhancement https://github.com/SPLWare/sqlazy/tree/master/examples/group-enhancement Reshape data for BI tools and reports – no more dynamic SQL or stored procedures. - Turn unique row values into dynamic columns automatic pivot tables - Split invoice totals evenly across line items while maintaining sum integrity πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/dynamic-reporting https://github.com/SPLWare/sqlazy/tree/master/examples/dynamic-reporting Real-world trading and finance SQL problems that analysts deal with daily. - Calculate the longest consecutive rising streak for any stock - Identify all stocks that have risen for more than 3 consecutive days - Generate OHLC price bars from raw tick data - Extract all rising streak periods for market analysis - Compute rolling averages and totals for technical indicators πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/financial-analysis https://github.com/SPLWare/sqlazy/tree/master/examples/financial-analysis Sessionization and event tracking patterns for user behavior analysis. - Split user activity into sessions based on inactivity timeouts - Add summary header rows before each user's event group - Backfill missing time intervals in user activity data - Track session-based counters that reset on new sessions πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/behavioral-analytics https://github.com/SPLWare/sqlazy/tree/master/examples/behavioral-analytics Complex summarization patterns that require stateful calculations across rows. - Dynamic conditional grouping with custom aggregation logic - Stateful running totals with reset triggers - Calculations that depend on values from previous consecutive rows - Nested ordered aggregation within hierarchical groups πŸ‘‰ https://github.com/SPLWare/sqlazy/tree/master/examples/advanced-aggregation https://github.com/SPLWare/sqlazy/tree/master/examples/advanced-aggregation - Step-by-step natural language β†’ SQL - Step debugging - Cross-database SQL generation - MySQL / PostgreSQL / Oracle support - Snowflake / BigQuery support - Recursive queries - Fully automatic workflow generation from plain English - Very old database versions e.g. MySQL 5.5 Typical AI SQL tools generate the final SQL directly . SQLazy takes a different approach: | Typical AI SQL tools | SQLazy | |---|---| | Generate final SQL | Generate step-by-step workflow | | Hard to review | Easy to review | | Hard to debug | Step debugging | | May hallucinate SQL | Final SQL generated by compiler | AI helps you write the logic . The compiler produces the trusted SQL . Basic SQL knowledge is helpful, but SQLazy reduces the need to: - write deeply nested queries - memorize complex window functions - deal with dialect differences You focus on logic , not syntax. Yes. SQLazy provides step-by-step debugging in both the Web App and Desktop IDE. You can execute each step and inspect intermediate results. This makes it useful not only for development, but also for: - learning how analytical SQL works - understanding window functions and grouping logic - experimenting with different parameters and transformations Many users use SQLazy as an interactive SQL learning environment . SQLazy is a development tool , not a runtime engine. The output of SQLazy is plain native SQL. You simply: - Copy the generated SQL - Paste it into your database, BI tool, or data platform - Run it No integration or deployment is required. No runtime engine is required. SQLazy uses the esProc SPL engine internally for step debugging only , so it can simulate execution and support multiple SQL dialects. From the user's perspective, SQLazy only produces portable SQL text . SQLazy focuses primarily on readability and correctness of generated SQL. The compiler performs basic logical optimizations, such as: - merging steps when possible - avoiding unnecessary CTE layers - combining aggregation and filtering into GROUP BY + HAVING Advanced performance optimization is expected to be handled by the database query optimizer . SQLazy is a query development and design tool . For debugging: - The Desktop IDE supports data sampling for large datasets - The Web App works with uploaded sample data Large-scale execution performance depends on the target database. SQLazy already supports complex analytical scenarios, including: - multi-table joins - window functions - advanced aggregations - time-series and sessionization logic Recursive queries are not yet supported but are on the roadmap. For extremely complex scenarios, the Desktop IDE can also generate SPL code as an alternative. Yes. The Desktop IDE can run fully offline and does not upload user data. The free edition requires an online license check at startup. The commercial edition works completely offline. Yes. These features are currently in development. Planned capabilities include: - user-defined functions and macros - branching and loops - support for complex stored-procedure-style workflows These features are planned for upcoming releases. This repository contains documentation and example workflows only . The SQLazy application Web App and Desktop IDE is proprietary software and is not included in this repository. All files inside the /examples directory are released under the MIT License. See the LICENSE /SPLWare/SQLazy/blob/master/LICENSE file for details. - Issues: https://github.com/SPLWare/sqlazy/issues https://github.com/SPLWare/sqlazy/issues - Forum: https://c.esproc.com/ https://c.esproc.com/ - Enterprise licensing: contact@scudata.com mailto:contact@scudata.com SQLazy is built on top of the esProc SPL engine: https://github.com/SPLWare/esProc https://github.com/SPLWare/esProc