Code Monkey home page Code Monkey logo

chatsql's Introduction

ChatSQL

基于ChatGLM-6B,实现nl2sql,直连数据库并返回查询结果 目前仅支持MYSQL语法,后续支持多数据库语法查询

✨整体思路

整体思路如上,目前采用yaml文件代替Table_info表结构

🎬开始

git clone [email protected]:yysirs/ChatSQL.git
cd ChatSQL
conda create -n chatsql python=3.9
conda activate chatsql
pip install -r requirements.txt
# 生成本地数据库+插入数据
python local_database.py
# 生成SQL
python main_gui.py

😁效果演示

👍 特性

  • 🛒 支持多表联查
  • 🖼️ 2023/04/24 支持web前端
  • 🎉 2023/04/24 支持yaml自定义数据库schema
  • 😁 2023/04/25 支持yaml自定义数据
  • 🎗️ 2023/04/25 支持直连本地数据库查询,验证SQL是否正确

各种类型的查询

# 单表多条件查询
请帮我查询在2019年的货物销售的净收益率大于10的货物名称

# 两表联查
请帮我查询在2019年的净收益率大于10并且销售量大于100的销售负责人名字

# 两表多条件联查
请帮我查询在2019年的货物的净收益率大于10并且销售量大于100并且销售负责人业绩大于1000的销售负责人名字

# max

# min

# COUNT

# AVG

# GROUP BY HAVING

# ORDER BY

# SUM	

# like

# TOP limit

TODO

  • 增加web前端
  • yaml可配置数据库schema
  • 采用sqlite本地数据库操作,验证SQL语句是否正确
  • 优化各类查询语句,如:ORDER BY、GROUP BY / HAVING 等复杂查询
  • 优化相似度查询模块
  • Docker部署
  • 其他SQL语法查询,如:ORACLE(关系型数据库)、Cypher(图数据库)

❤️致谢

  • ChatGLM-6B:ChatGLM-6B模型提供大语言模型能力

chatsql's People

Contributors

yysirs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.