Beyond Text-to-SQL: Can LLMs Really Debug Enterprise ETL SQL?

Jing Ye, Yiwen Duan, Yonghong Yu, Xinpei Zhao, Yang Gao, Xing Chen
Proceedings of the 43rd International Conference on Machine Learning, PMLR 306:148234-148261, 2026.

Abstract

SQL is central to enterprise data engineering, yet generating fully correct SQL code in a single attempt remains difficult—even for experienced developers and advanced Text-to-SQL LLMs—often requiring multiple debugging iterations. We introduce Squirrel Benchmark, the first benchmark for enterprise-level SQL reasoning and debugging. Our benchmark is built upon two key innovations: (1) an automated construction workflow that employs reverse engineering to systematically inject realistic bugs into large-scale SQL code, enabling scalable and diverse benchmark generation; and (2) an execution-free evaluation framework tailored for enterprise settings, providing fast, accurate, and resource-efficient assessment. Squirrel comprises 469 Squirrel-Syntax queries featuring syntax errors with explicit error messages, and 516 Squirrel-Semantic queries targeting semantic errors where code fails to meet user intent. The queries are highly complex, averaging over 140 lines and featuring deep, wide abstract syntax trees (average width $>$11, depth $>$8.7). Evaluation of nearly 30 LLMs reveals a substantial performance gap: the best-performing model, Claude-4-Sonnet, achieves only 36.46% accuracy on Squirrel-Syntax and 32.17% on Squirrel-Semantic, while most models score below 20%. We further explore four solution strategies, identify key challenges, and outline promising directions for enterprise SQL debugging with LLMs.

Cite this Paper


BibTeX
@InProceedings{pmlr-v306-ye26d, title = {Beyond Text-to-{SQL}: Can {LLM}s Really Debug Enterprise {ETL} {SQL}?}, author = {Ye, Jing and Duan, Yiwen and Yu, Yonghong and Zhao, Xinpei and Gao, Yang and Chen, Xing}, booktitle = {Proceedings of the 43rd International Conference on Machine Learning}, pages = {148234--148261}, year = {2026}, editor = {Zhang, Tong and Dudik, Miroslav and Jaggi, Martin and Agarwal, Alekh and Li, Sharon and Schuurmans, Dale and Zhu, Jerry and Berkenkamp, Felix and Dong, Hanze and Bietti, Alberto}, volume = {306}, series = {Proceedings of Machine Learning Research}, month = {06--11 Jul}, publisher = {PMLR}, pdf = {https://raw.githubusercontent.com/mlresearch/v306/main/assets/ye26d/ye26d.pdf}, url = {https://proceedings.mlr.press/v306/ye26d.html}, abstract = {SQL is central to enterprise data engineering, yet generating fully correct SQL code in a single attempt remains difficult—even for experienced developers and advanced Text-to-SQL LLMs—often requiring multiple debugging iterations. We introduce Squirrel Benchmark, the first benchmark for enterprise-level SQL reasoning and debugging. Our benchmark is built upon two key innovations: (1) an automated construction workflow that employs reverse engineering to systematically inject realistic bugs into large-scale SQL code, enabling scalable and diverse benchmark generation; and (2) an execution-free evaluation framework tailored for enterprise settings, providing fast, accurate, and resource-efficient assessment. Squirrel comprises 469 Squirrel-Syntax queries featuring syntax errors with explicit error messages, and 516 Squirrel-Semantic queries targeting semantic errors where code fails to meet user intent. The queries are highly complex, averaging over 140 lines and featuring deep, wide abstract syntax trees (average width $>$11, depth $>$8.7). Evaluation of nearly 30 LLMs reveals a substantial performance gap: the best-performing model, Claude-4-Sonnet, achieves only 36.46% accuracy on Squirrel-Syntax and 32.17% on Squirrel-Semantic, while most models score below 20%. We further explore four solution strategies, identify key challenges, and outline promising directions for enterprise SQL debugging with LLMs.} }
Endnote
%0 Conference Paper %T Beyond Text-to-SQL: Can LLMs Really Debug Enterprise ETL SQL? %A Jing Ye %A Yiwen Duan %A Yonghong Yu %A Xinpei Zhao %A Yang Gao %A Xing Chen %B Proceedings of the 43rd International Conference on Machine Learning %C Proceedings of Machine Learning Research %D 2026 %E Tong Zhang %E Miroslav Dudik %E Martin Jaggi %E Alekh Agarwal %E Sharon Li %E Dale Schuurmans %E Jerry Zhu %E Felix Berkenkamp %E Hanze Dong %E Alberto Bietti %F pmlr-v306-ye26d %I PMLR %P 148234--148261 %U https://proceedings.mlr.press/v306/ye26d.html %V 306 %X SQL is central to enterprise data engineering, yet generating fully correct SQL code in a single attempt remains difficult—even for experienced developers and advanced Text-to-SQL LLMs—often requiring multiple debugging iterations. We introduce Squirrel Benchmark, the first benchmark for enterprise-level SQL reasoning and debugging. Our benchmark is built upon two key innovations: (1) an automated construction workflow that employs reverse engineering to systematically inject realistic bugs into large-scale SQL code, enabling scalable and diverse benchmark generation; and (2) an execution-free evaluation framework tailored for enterprise settings, providing fast, accurate, and resource-efficient assessment. Squirrel comprises 469 Squirrel-Syntax queries featuring syntax errors with explicit error messages, and 516 Squirrel-Semantic queries targeting semantic errors where code fails to meet user intent. The queries are highly complex, averaging over 140 lines and featuring deep, wide abstract syntax trees (average width $>$11, depth $>$8.7). Evaluation of nearly 30 LLMs reveals a substantial performance gap: the best-performing model, Claude-4-Sonnet, achieves only 36.46% accuracy on Squirrel-Syntax and 32.17% on Squirrel-Semantic, while most models score below 20%. We further explore four solution strategies, identify key challenges, and outline promising directions for enterprise SQL debugging with LLMs.
APA
Ye, J., Duan, Y., Yu, Y., Zhao, X., Gao, Y. & Chen, X.. (2026). Beyond Text-to-SQL: Can LLMs Really Debug Enterprise ETL SQL?. Proceedings of the 43rd International Conference on Machine Learning, in Proceedings of Machine Learning Research 306:148234-148261 Available from https://proceedings.mlr.press/v306/ye26d.html.

Related Material