AutoSQL: Extracting SQL Templates from Imperative ORM Code in Large-Scale Repositories
- URL: http://arxiv.org/abs/2608.15595v1
- Date: Sun, 16 Aug 2026 07:32:53 GMT
- Title: AutoSQL: Extracting SQL Templates from Imperative ORM Code in Large-Scale Repositories
- Abstract summary: We present Auto sequences, a system that reconstructssql templates from Go ORM code.<n>We show that Auto achieves 68.04% to 72.18% recall, exceeding the static reachability baseline by 11.80% to 15.94% and outperforming existing methods by 8.52% to 21.50%.
- Score: 43.381882752672446
- License: http://creativecommons.org/licenses/by-nc-nd/4.0/
- Abstract: Suboptimal SQL queries can significantly degrade the performance of cloud systems, motivating the extraction and auditing of SQL statements before deployment. However, Go ORM frameworks construct SQL imperatively through scattered method-call sequences, making it difficult to statically recover the resulting SQL templates. We present AutoSQL, a system that reconstructs SQL templates from Go ORM code. AutoSQL constructs a Code Index, a directed graph that captures structural dependencies between functions, types, and global variables as navigable edges. It then traces upstream call chains from ORM invocation sites to identify database-interacting functions as entry points. For each entry point, an LLM agent traverses the Code Index to collect code slices that influence SQL generation, switching to pattern-based search when the graph cannot resolve a retrieval goal. We call this strategy Hybrid Context Retrieval. Once sufficient context is collected, the agent synthesizes SQL templates. Evaluation on a benchmark of 579 test-covered entry points and 1,186 runtime-traced SQL statements from five large-scale Go repositories shows that AutoSQL achieves 68.04% to 72.18% recall, exceeding the static reachability baseline by 11.80% to 15.94% and outperforming existing methods by 8.52% to 21.50%.
Related papers
- TraceSQL: Traceable Answerability Estimation for Reference-Free Text-to-SQL Verification [0.14658400971135652]
Given only a user question, database context, and generatedsql, can a system estimate whether the generated query is likely to correctly answer the question?<n>Recent approaches use LLMs as judge or specialized agents to inspect generatedsql, but their decisions can be difficult to trace.<n>We propose Trace, a lightweight and traceable verification model built on explicit diagnostic features.<n>Trace achieves 66.47% F1 and 64.48% ROC-AUC, compared with 61.87% F1 and 5826% ROC-AUC for the Grade-7B ORM baseline on the same generated- semantic evaluation.
arXiv Detail & Related papers (2026-08-18T13:56:29Z) - Spider 2.0-AIFunc: Extending Real-World Text-to-SQL to AI-Native SQL Workflows [54.49251107006261]
We introduce Spider 2.0-AIFunc, a benchmark of 465 verified instances across 125 real-world databases covering six types of AI functions on the Snowflake platform.<n>We find that the strongest proprietary models reach 67-70% execution accuracy while the best open-source model achieves 58.1%.
arXiv Detail & Related papers (2026-07-07T12:54:08Z) - Schema-First Retrieval: Embedding Catalogs for Natural Language Analytics [0.10210859604701106]
Modern warehouses contain thousands of tables, abbreviated columns, informal metrics, hidden join conventions, and permission boundaries not captured by raw table names.<n>We introduce Enterprise-First Retrieval, a retrieval layer that embeds catalog metadata rather than warehouse rows.<n>The system indexes five typed catalog objects, tables, columns, metrics, relationships, and query history, using object-specific text templates.
arXiv Detail & Related papers (2026-06-23T02:20:36Z) - ProSPy: A Profiling-Driven SQL-Python Agentic Framework for Enterprise Text-to-SQL [51.98164069124653]
ProSPy is a Profiling-driven framework for enterprise-scale Text-to-gnostic analysis.<n>ProSPy structures the reasoning process into four stages.<n>It first extracts fine-grained data evidence through automatic profiling.<n>It prunes large schemas into task-relevant contexts.
arXiv Detail & Related papers (2026-06-04T08:13:05Z) - FlexSQL: Flexible Exploration and Execution Make Better Text-to-SQL Agents [36.84900072417659]
We present Flex Code, a text-to-agent whose core design principle is flexible database interaction.<n>Our approach yields over 10% relative improvement on Spider2-Snow.
arXiv Detail & Related papers (2026-05-04T16:51:31Z) - AV-SQL: Decomposing Complex Text-to-SQL Queries with Agentic Views [40.813123705793764]
We introduce AV-, a framework that decomposes complex Text-to-LLMs into specialized agents.<n> AV- operates in three stages: (1) a rewriter agent compresses and clarifies the input query; (2) a view agent processes chunks to produce agentic views; and (3) a planner, generator, and revisor agent collaboratively generates the views into the final query.
arXiv Detail & Related papers (2026-04-08T12:56:13Z) - Track-SQL: Enhancing Generative Language Models with Dual-Extractive Modules for Schema and Context Tracking in Multi-turn Text-to-SQL [50.84251174559123]
Generative language models' performance does not extend equivalently to multi-turn Text-to-sourced.<n>We propose Track-, which enhances generative language models with dual-extractive modules designed to track schema and contextual changes in multi-turn Text-to-sourced.<n>Track- significantly improves execution accuracy in multi-turn interactions by 7.1% and 9.55% on datasets, respectively.
arXiv Detail & Related papers (2026-03-06T07:57:06Z) - AutoLink: Autonomous Schema Exploration and Expansion for Scalable Schema Linking in Text-to-SQL at Scale [68.29002818359844]
Existing methods incur prohibitive costs, struggle to trade off recall and noise, and scale poorly to large databases.<n>We present textbfAutoLink, an autonomous agent framework that reformulates schema linking as an iterative, agent-driven process.<n>Experiments demonstrate AutoLink's superior performance, achieving state-of-the-art strict schema linking recall, i.e., textbf68.7% EX on Bird-Dev (better than CHESS) and textbf34.9% EX on Spider-2.0-Lite (ranking 2nd
arXiv Detail & Related papers (2025-11-21T12:12:17Z) - Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows [64.94146689665628]
Spider 2.0 is an evaluation framework for real-world text-to-sql problems derived from enterprise-level database use cases.<n>The databases in Spider 2.0 are sourced from real data applications, often containing over 1,000 columns and stored in local or cloud database systems such as BigQuery and Snowflake.<n>We show that solving problems in Spider 2.0 frequently requires understanding and searching through database metadata, dialect documentation, and even project-levels.
arXiv Detail & Related papers (2024-11-12T12:52:17Z) - RSL-SQL: Robust Schema Linking in Text-to-SQL Generation [51.00761167842468]
We propose a novel framework called RSL- that combines bidirectional schema linking, contextual information augmentation, binary selection strategy, and multi-turn self-correction.
benchmarks demonstrate that our approach achieves SOTA execution accuracy among open-source solutions, with 67.2% on BIRD and 87.9% on GPT-4ocorrection.
Our approach outperforms a series of GPT-4 based Text-to-Seek systems when adopting DeepSeek (much cheaper) with same intact prompts.
arXiv Detail & Related papers (2024-10-31T16:22:26Z) - MAG-SQL: Multi-Agent Generative Approach with Soft Schema Linking and Iterative Sub-SQL Refinement for Text-to-SQL [15.824894030016187]
Recent In-Context Learning based methods have achieved remarkable success in Text-to-Context task.
There is still a large gap between the performance of these models and human performance on datasets with complex database schema and difficult questions, such as.
In our framework, an entity-based method with tables' summary is used to select the columns in database, and a novel targets-conditions decomposition method is introduced to decompose those complex questions.
arXiv Detail & Related papers (2024-08-15T04:57:55Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.