# sqlchat **Repository Path**: yaoqis/sqlchat ## Basic Information - **Project Name**: sqlchat - **Description**: SQL Chat 是一个基于对话式交互的 SQL 客户端,可以使用自然语言询问数据库问题和查询数据库 - **Primary Language**: TypeScript - **License**: Not specified - **Default Branch**: main - **Homepage**: https://www.oschina.net/p/sqlchat - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 8 - **Created**: 2023-04-23 - **Last Updated**: 2023-04-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 
## What SQL Chat is a chat-based SQL client to ask database questions and query databases using natural language.   ## Why As we enter the [Developer Tools 2.0 era](https://www.sequoiacap.com/article/ai-powered-developer-tools/), there is a massive opportunity to rebuild the existing tools using the chat-based interface. SQL Client is no exception. Instead of navigating across many UI controls, a chat-based interface is much more intuitive. Of course, only if that works, and our goal is to deliver that experience. ## How SQL Chat is built by Next.js, it supports the following databases and will add more over time: - MySQL - PostgreSQL - MSSQL ## Data Privacy - All database connection configs are stored locally in your browser. You can also visit settings to clear the data. - Only the database schema will be sent to the OpenAI API. No table data will be sent there. ## IP Whitelisting If you use [sqlchat.ai](https://sqlchat.ai) to connect to your database, you need to add 0.0.0.0 (allow all connections) to the database whitelist IP. Because sqlchat.ai is hosted on Vercel which [uses dynamic IP](https://vercel.com/guides/how-to-allowlist-deployment-ip-address). If this is a concern, please consider the self-host option below. ## Self-host with Docker ```bash docker run --name sqlchat --platform linux/amd64 -p 3000:3000 sqlchat/sqlchat ``` You can set the following environment variables to customize the deployment: - `OPENAI_API_KEY`: OpenAI API key. You can get one from [here](https://beta.openai.com/docs/developer-quickstart/api-keys). - `OPENAI_API_ENDPOINT`: OpenAI API endpoint. Defaults to `https://api.openai.com`. ```bash docker run --name sqlchat --platform linux/amd64 --env OPENAI_API_KEY=xxx --env OPENAI_API_ENDPOINT=yyy -p 3000:3000 sqlchat/sqlchat ``` ## Local Development 1. Make a copy of the example environment variables file; ```bash cp .env.example .env ``` 2. Add your [API key](https://platform.openai.com/account/api-keys) and OpenAI API Endpoint(optional) to the newly created `.env` file; 3. Install dependencies and start the dev server; ```bash pnpm i && pnpm dev ``` ## Common Questions
- You can deploy SQL Chat to Vercel with one click
- You can deploy your SQL Chat with docker in seconds
```bash
docker run --name sqlchat --platform linux/amd64 -p 3000:3000 sqlchat/sqlchat
```
Please make sure you have a stable network connection which can access the OpenAI API endpoint. If you cannot access the OpenAI API endpoint, you can try to set the `OPENAI_API_ENDPOINT` in UI or environment variable.