An intelligent and versatile general-purpose SQL client and reporting tool for databases which integrates ChatGPT capabilities.
Share Chat2DB Repository
License Notation: Chat2DB is constructed and distributed for personal and non-commercial use only. For commercial use of this project, please contact corresponding authors.
Languages: English | 中文
demo2.0.mp4
Chat2DB is a multi-database client tool that is open-source and free. It supports local installation on Windows and Mac, as well as server-side deployment and web page access. Compared to traditional database client software such as Navicat and DBeaver, Chat2DB integrates AIGC's capabilities and is able to convert natural language into SQL. It can also convert SQL into natural language and provide optimization suggestions for SQL to greatly enhance the efficiency of developers. It is a tool for database developers in the AI era, and even non-SQL business operators in the future can use it to quickly query business data and generate reports.
- 🌈 AI intelligent assistant, supporting natural language to SQL conversion, SQL to natural language conversion, and SQL optimization suggestions
- 👭 Support team collaboration, developers do not need to know the online database password, solving the problem of enterprise database account security
- ⚙️ Powerful data management capability, supporting management of data tables, views, stored procedures, functions, triggers, indexes, sequences, users, roles, authorizations, etc.
- 🔌 Powerful extension capability, currently supporting MySQL, PostgreSQL, Oracle, SQLServer, ClickHouse, OceanBase, H2, SQLite, etc., and more databases will be supported in the future
- 🛡 Front-end development using Electron, providing a solution that integrates Windows, Mac, Linux clients, and web versions
- 🎁 Support environment isolation, online, and daily data permission separation
Downloading installation package from GitHub
Downloading installation package from official website
Chat2DB supports connecting to the following databases:
- MySQL
- PostgreSQL
- H2
- Oracle
- SQLServer
- SQLLite
- MariaDB
- ClickHouseare
- DM
- Presto
- DB2
- OceanBase
- Hive
- KingBase
Redis and MongoDB are partially supported , Hbase、Elasticsearch、openGauss、TiDB、InfluxDB will support in the future.
Option 1 (recommended): To use the ChatSql function of OPENAI, two conditions must be met:
- You need an OPENAI_API_KEY.
- The client's network can connect to the OPENAI website, and for users in China, a VPN is required. Note: If the local VPN is not fully effective, the network connectivity can be ensured by setting the network proxy HOST and PORT in the client.
![3](https://private-user-images.githubusercontent.com/22975773/254293719-95c8a766-cc6b-4767-90e6-a8b616a89bc7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDU2MjQsIm5iZiI6MTcyNDEwNTMyNCwicGF0aCI6Ii8yMjk3NTc3My8yNTQyOTM3MTktOTVjOGE3NjYtY2M2Yi00NzY3LTkwZTYtYThiNjE2YTg5YmM3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIyMDg0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE5YjI0OTMwOTk5YWZjODhiYWY1YzkwZGZiNzBmYjYxNzVmM2RmOGRlMzU0MDQyYzYwN2RiZGMzZjFmN2VjYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.KmmfrSxbednla1ux1uQj7bmyTTLV0H2ywuOdRoYK5RA)
Option 2 (recommended): We provide a unified proxy service.
- No OPENAI_API_KEY is required.
- No proxy or VPN is required, as long as the network is connected.
To facilitate users' quick use of AI capabilities, you can scan the QR code below to follow our WeChat public account and apply for our custom API_KEY.
![4](https://private-user-images.githubusercontent.com/22975773/254293730-9236ff01-e49f-4e45-96b0-201e85fcd756.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDU2MjQsIm5iZiI6MTcyNDEwNTMyNCwicGF0aCI6Ii8yMjk3NTc3My8yNTQyOTM3MzAtOTIzNmZmMDEtZTQ5Zi00ZTQ1LTk2YjAtMjAxZTg1ZmNkNzU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIyMDg0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcwODk3ZGE3NGM1ZGE2N2RmMmE0MDg5YTVhNTBhYzgyNDlkZDE0NmQwMDE3OWMzMTViMmUyY2Y0N2NiYWI3NDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Ar-FSmwKO1R4M0kWtH3dKSzMmpgnE5n1nXYtMsCaI5I)
- Customized AI can be any LLM that you deployed, such as ChatGLM、ChatGPT、ERNIE Bot、Tongyi Qianwen, and so on. However, the customized interface need to conform to the protocol definition. Otherwise, secondary development may be required. Two DEMOs are provided in the code, the configuration is as shown below. In specific use, you can refer to the DEMO interface to write a custom interface, or directly perform secondary development in the DEMO interface.
- DEMO for configuring customized stream output interface.
- DEMO for configuring customized non-stream output interface.
![5](https://private-user-images.githubusercontent.com/22975773/254294190-aff8497e-3edb-449d-a7d4-bb0429abc67c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDU2MjQsIm5iZiI6MTcyNDEwNTMyNCwicGF0aCI6Ii8yMjk3NTc3My8yNTQyOTQxOTAtYWZmODQ5N2UtM2VkYi00NDlkLWE3ZDQtYmIwNDI5YWJjNjdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIyMDg0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkxZWVkNTI2YmJlYjNiYmFkMDYwZjY4ZGE5ZGVjNDczNjNjN2ZkZjM5YmIyYzI2ODZhYmZmYTQ4MzI0MTJiYjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.fZHIt91v9J7RTAL7Oy-Vjj6bpPr6ZegV4zil-WMmDNI)
```bash
// Pull the latest client, then run Docker with the name 'chat2db', and mount 'root. chat2db' to '~. chat2db Docker'`
docker run --name=chat2db -ti -p 10824:10824 -v ~/.chat2db-docker:/root/.chat2db chat2db/chat2db:latest
// The normal prompt here is' Tomcat started on port (s): 10824 (http) with context path ', which will complete the process
// If the prompt 'The container name "chat2db" is already in use by container' appears here, it means that the container already exists and is running
docker start chat2db
// If you want to update chat2db, you need to first rm
docker rm chat2db
## 🎯 Operating Environment
Note: If local debugging is required
- Java runtime Open JDK 17
- JRE reference packaging and deployment method of jre.
- Node runtime environment Node16 Node.js.
## 💻 Local Debugging
- git clone to local
```bash
$ git clone [email protected]:alibaba/Chat2DB.git
- Front-End debug
node version must be 16 or later
Be sure to use yarn
$ cd Chat2DB/chat2db-client
$ yarn
$ yarn run start:web
- Backend debug
$ cd ../chat2db-server
$ mvn clean install # maven 3.8 or later needs to be installed
$ cd chat2db-server/chat2db-server-start/target/
$ java -jar -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # To launch the chat application, you need to enter the ChatGPT key for the chatgpt.apiKey. Without entering it, you won't be able to use the AIGC function.
Please star and fork on GitHub before joining the group. Follow our WeChat public account.
Thanks to all the students who contributed to Chat2DB~