SQL-to-Schema Enhances Schema Linking in Text-to-SQL

Sun Yang, Qiong Su, Zhishuai Li, Ziyue Li, Hangyu Mao +2 more
5/15/2024
cs.DBcs.AI

No confident code implementation found for this paper. 4 possible matches can be shown below.

Abstract

In sophisticated existing Text-to-SQL methods exhibit errors in various proportions, including schema-linking errors (incorrect columns, tables, or extra columns), join errors, nested errors, and group-by errors. Consequently, there is a critical need to filter out unnecessary tables and columns, directing the language models attention to relevant tables and columns with schema-linking, to reduce errors during SQL generation. Previous approaches have involved sorting tables and columns based on their relevance to the question, selecting the top-ranked ones for sorting, or directly identifying the necessary tables and columns for SQL generation. However, these methods face challenges such as lengthy model training times, high consumption of expensive GPT-4 tokens in few-shot prompts, or suboptimal performance in schema linking. Therefore, we propose an inventive schema linking method in two steps: Firstly, generate an initial SQL query by utilizing the complete database schema. Subsequently, extract tables and columns from the initial SQL query to create a concise schema. Using CodeLlama-34B, when comparing the schemas obtained by mainstream methods with ours for SQL generation, our schema performs optimally. Leveraging GPT4, our SQL generation method achieved results that are comparable to mainstream Text-to-SQL methods on the Spider dataset.

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. 4 weaker matches are hidden by default — 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{yang2024sqltoschema,
  title  = {SQL-to-Schema Enhances Schema Linking in Text-to-SQL},
  author = {Sun Yang and Qiong Su and Zhishuai Li and Ziyue Li and Hangyu Mao and Chenxi Liu and Rui Zhao},
  year   = {2024},
  eprint = {2405.09593},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.09593v1}
}

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/2405.09593.svg)](https://codeofpaper.com/paper/2405.09593)

Discussion