How Do You Break the Query Ticket Queue? AI Coding Cannot Fix It Either

2png
It routinely takes three to five days from submission to delivery, and the tickets pile up longer and longer. How do you fix that?
Some say: bring in AI coding.
True, AI writes SQL fast. But when the statement in front of you is a hundred-line lump, do you dare trust it? Review it by hand? That is barely faster than writing it yourself, and the queue stays a queue.
Can AI fix its own errors? Syntax errors are easy: the database refuses to run them, so let AI take another pass. Whether the business logic is right is something it cannot tell. AI coding usually leans on tests as a safety net, and in many repeatedly-run scenarios that works well: fixed reports, scheduled jobs and so on. Write the tests once, reuse them a hundred times, and the cost is spread thin.
Data analysis tickets break that assumption, because nearly every request is a one-off. It is answered once and finished; building test cases costs more than writing the code, so the work gets done twice and the queue only grows.
Then let AI generate the test cases? That just moves the hallucination somewhere else. Nobody knows whether the tests it writes are any good.

What has to come down is the cost of auditing the code, and that is the job of AI + SQLazy. SQLazy is a plain, readable structured data computation language, with clear steps, deterministic output and easy auditing:

t2=tb_fromto: filter ((start_row notnull) and (end_row notnull))
t3=expand tb_fromto as src_id; take value as src_value, ffrom as src_ffrom, fto as src_fto
t4=filter (src_id >= start_row and src_id <= end_row and (src_ffrom = ffrom or src_fto = ffrom))
t5=summarize sum src_value as sumvals; group id

**Every line is plain language you grasp at once, one action per step, and every result is there to look at whenever you want. Run it and you know whether it is right. **The cost of auditing drops to nearly nothing.
And then? Then you compile it into SQL and you are done:

WITH t2 AS (
		SELECT ffrom, fto, value, id, start_row
			, end_row
		FROM (
			SELECT ffrom, fto, value, id, start_row
				, end_row
			FROM tb_fromto
		) t_1
		WHERE (start_row IS NOT NULL
			AND end_row IS NOT NULL)
	),
	t3 AS (
		SELECT t2.ffrom, t2.fto, t2.value, t2.id, t2.start_row
			, t2.end_row, t1.id AS src_id, t1.value AS src_value, t1.ffrom AS src_ffrom, t1.fto AS src_fto
		FROM t2
			CROSS JOIN tb_fromto t1
	)
SELECT id, SUM(src_value) AS sumvals
FROM (
	SELECT ffrom, fto, value, id, start_row
		, end_row, src_id, src_value, src_ffrom, src_fto
	FROM t3
	WHERE src_id >= start_row
		AND src_id <= end_row
		AND (src_fto = ffrom
			OR src_ffrom = ffrom)
) t_3
GROUP BY id
ORDER BY id 

Same logic, same output, every time. The SQL is generated by the compiler, not improvised by AI: no probability, no hallucination.
One-off tickets are no different: readable, changeable, auditable, with no test cases to build and no rewrite from scratch. Tickets queuing up should not be normal.