ProSPy: A Profiling-Driven SQL-Python Agentic Framework for Enterprise Text-to-SQL

Zhaorui Yang, Huawei Zheng, Sen Yang, Yuhui Zhang, Haoxuan Li +12 more
6/4/2026
cs.CL

No confident code implementation found for this paper.

Abstract

Large language models have substantially advanced Text-to-SQL systems, yet applying them to enterprise-scale databases remains challenging. Real-world databases often contain large and heterogeneous schemas, incomplete metadata, dialect-specific SQL syntax, and complex analytical questions that are difficult to solve with a single SQL query.

Show full abstract

To address these challenges, we propose ProSPy, a Profiling-driven SQL--Python agentic framework for enterprise-scale Text-to-SQL. ProSPy structures the reasoning process into four stages: it first extracts fine-grained data evidence through automatic profiling, progressively prunes large schemas into task-relevant contexts, fetches intermediate views through a dialect-agnostic SQL interface, and finally performs flexible downstream analysis with Python. This design combines the efficiency of SQL over large databases with the flexibility of Python-based analysis, while reducing reliance on unreliable metadata and improving robustness across SQL dialects. Experiments on Spider 2.0-Lite and Spider 2.0-Snow show that ProSPy consistently outperforms strong baselines with both open-source and proprietary models, achieving execution accuracies of 60.15% and 60.51% with Claude-4.5-Opus, without majority voting. Further analysis shows that ProSPy is robust to SQL dialect variations and achieves a favorable trade-off between schema recall and precision.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{yang2026prospy,
  title  = {ProSPy: A Profiling-Driven SQL-Python Agentic Framework for Enterprise Text-to-SQL},
  author = {Zhaorui Yang and Huawei Zheng and Sen Yang and Yuhui Zhang and Haoxuan Li and Zhizhen Yu and Xuan Yi and Chen Hou and Defeng Xie and Chao Hu and Minfeng Zhu and Dazhen Deng and Haozhe Feng and Danqing Huang and Yingcai Wu and Peng Chen and Wei Chen},
  year   = {2026},
  eprint = {2606.05836},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.05836v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.05836.svg)](https://codeofpaper.com/paper/2606.05836)

Discussion