一种基于混合视图检索的Text2SQL生成方法及系统

By generating enhanced schema description documents through hybrid view retrieval technology and combining vector similarity and graph structure propagation algorithms, the recall and accuracy problems of existing Text-to-SQL technologies in complex databases are solved, achieving efficient and accurate SQL generation.

CN121996663BActive Publication Date: 2026-07-17HANGZHOU DIANZI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU DIANZI UNIV
Filing Date
2026-04-10
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing Text-to-SQL technologies struggle to understand the complex structures of real-world industrial databases, exhibiting issues such as ambiguous column names, undefined implicit foreign keys, noise introduced by expanding the search scope, and errors in generative models during multi-table joins and nested queries.

Method used

A hybrid view-based retrieval method is adopted, which generates enhanced schema description documents through data profiling and mining, obtains candidate schema elements by combining vector similarity retrieval and graph structure propagation algorithms, constructs multiple candidate SQL statements, executes and verifies them in the database environment, and makes corrections based on the consistency of execution results.

Benefits of technology

It reduces the illusion of selecting table columns in large language models, improves the recall rate of schema elements and the accuracy of SQL generation, enhances robustness, and reduces the illusion risk of generative models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996663B_ABST
    Figure CN121996663B_ABST
Patent Text Reader

Abstract

本发明公开了一种基于混合视图检索的Text2SQL生成方法及系统,该方法首先对数据库进行数据画像挖掘,生成描述表列业务语义、枚举值含义及隐式关联关系的增强Schema描述文档。其次接收用户的自然语言查询,生成假设性SQL语句,基于增强的Schema描述文档,获取建议检索集合。然后构建包含建议检索集合的输入约束信息,生成多路候选SQL语句。最后在数据库环境中执行多路候选SQL语句,并进行验证,若验证通过则输出结果,若验证失败则触发修正流程,生成修正后的SQL语句。本发明降低大语言模型选择表列的幻觉,提高在复杂查询时的Schema元素召回率和SQL生成的准确率与鲁棒性。
Need to check novelty before this filing date? Find Prior Art