Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Chat-based SQL Client and Editor for the next decade

License

NotificationsYou must be signed in to change notification settings

sqlchat/sqlchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Chat banner

SQL Chat

vercel

English |中文 |Español

What

SQL Chat is a chat-based SQL client, which uses natural language to communicate with the database to implement operations such as query, modification, addition, and deletion of the database.

Screenshot

Screenshot

Screenshot

Why

As we enter theDeveloper Tools 2.0 era,there is a massive opportunity to rebuild the existing tools using the chat-based interface. SQL Clientis no exception. Instead of navigating across many UI controls, a chat-based interface is muchmore intuitive. Of course, only if that works, and our goal is to deliver that experience.

How

SQL Chat is built byNext.js, it supports the following databases and will add more over time:

  • MySQL
  • PostgreSQL
  • MSSQL
  • TiDB Cloud
  • OceanBase

IP Whitelisting

If you usesqlchat.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 onVercel whichuses dynamic IP. If this is a concern, please consider the self-host option below.

Data Privacy

SeeSQL Chat Privacy Policy.

Self-host

Docker

If you just want to run for your own use, supply the following options:

  • NEXTAUTH_SECRET
  • OPENAI_API_KEY
docker run --name sqlchat --platform linux/amd64 --env NEXTAUTH_SECRET="$(openssl rand -hex 5)" --env OPENAI_API_KEY=<<YOUR OPENAI KEY>> -p 3000:3000 --hostname localhost sqlchat/sqlchat
  • Pass an arbitrary string to NEXTAUTH_SECRET otherwise next-auth will complain.
  • If you chat to the database on the same host, you need to usehost.docker.internal as the host inthe database connection setting.

Startup options

TL;DR

  • If you just want to use for yourself, then run without database. Check.env.nodb.
  • If you want to offer a similar service assqlchat.ai, then run with database, check.env.usedb. The database is used to store account, usage info.

OpenAI related

  • OPENAI_API_KEY: OpenAI API key. You can get one fromhere.

  • OPENAI_API_ENDPOINT: OpenAI API endpoint. Defaults tohttps://api.openai.com. UseOllama to set up self-host AI model and set the endpoint to it.

  • NEXT_PUBLIC_ALLOW_SELF_OPENAI_KEY: Set totrue to allow users to bring their own OpenAI API key.

Database related

  • NEXT_PUBLIC_USE_DATABASE: Set totrue to start SQL Chat with database. This willenable following features:
    1. Account system.
    2. Per-user quota enforcement.
    3. Payment.
    4. Usage data collection.
  • DATABASE_URL: Applicable ifNEXT_PUBLIC_USE_DATABASE istrue. Postgres connection string to store data. e.g.postgresql://postgres:YOUR_PASSWORD@localhost:5432/sqlchat?schema=sqlchat.

Local Development

  1. Install dependencies

    pnpm i
  2. Generate prisma client

    pnpm prisma generate
  3. Make a copy of the example environment variables file:

    cp .env.usedb .env
  4. Add yourAPI key and OpenAI API Endpoint(optional) to the newly created.env file.

Setup database

You can skip this section withNEXT_PUBLIC_USE_DATABASE=false if you don't build features requiring database

  1. Start a Postgres instance. For mac, you can useStackbBricks,DBngin orPostgres.app.

  2. Create a database:

    CREATEDATABASEsqlchat;

    In.env file, assign the connection string to environment variableDATABASE_URL andDATABASE_DIRECT_URL.This article explains why we need two URLs.

  3. Set up database schema

    pnpm prisma migrate dev
  4. (Optional) Seed data

    pnpm prisma db seed

Star History

Star History Chart

Community

Follow us on Twitter

sqlchat

Sponsors

Common Error Message

Please sign up to get free quota

Seethis issue.

You exceeded your current quota, please check your plan and billing details

openai quota

Your OpenAI Key has run out of quota. Please check yourOpenAI account.

Failed to request message, please check your network

network error

Please make sure you have a stable network connection which can access the OpenAI API endpoint.

ping api.openai.com

If you cannot access the OpenAI API endpoint, you can try to set theOPENAI_API_ENDPOINT in UI or environment variable.


[8]ページ先頭

©2009-2025 Movatter.jp