Forget Navicat: How an AI‑Powered SQL Chat Tool Writes Queries for You
SQL Chat, an open‑source AI‑driven database client with 5.8K stars, lets you converse in natural language to generate and run SQL across MySQL, PostgreSQL, MSSQL, TiDB Cloud and OceanBase, while keeping data local and offering Docker self‑hosting, but it still cannot replace full‑featured tools for complex tasks.
While browsing GitHub Trending I discovered SQL Chat, an open‑source AI‑driven database client with 5.8K stars, MIT‑licensed and created by the Bytebase team. I initially thought it was a gimmick, but after installing it and connecting to MySQL the traditional Navicat client was quickly minimized.
Overview
SQL Chat is a chat‑style database client built with Next.js. It supports MySQL, PostgreSQL, MSSQL, TiDB Cloud and OceanBase. Connection configurations are stored locally in the browser, and only the database schema (not table data) is sent to OpenAI as part of the prompt.
Chat‑style Query
The UI consists of a left panel showing connection lists and a schema tree, and a right‑hand conversation window. When I typed 每个部门工资最高的前 10 名员工 ("Top 10 highest‑paid employees per department"), the assistant replied with a highlighted SQL statement, a natural‑language explanation of the JOINs and WHERE clauses, and an execute button.
The generated JOIN query was cleaner than my hand‑written version, with reasonable sub‑query placement. An execution‑plan check showed that indexes were used and no full‑table scans occurred.
Result Presentation
The SQL can be run directly; results appear in a paginated table. My employee table contained 802 rows, and the query returned 10 rows per page with fast paging.
Both the SQL and its result are displayed in the same chat bubble, and the conversation history retains the original natural‑language question, making it more intuitive than the traditional "query history" view that only shows isolated SQL statements.
Schema Auto‑Detection
After establishing a connection, SQL Chat automatically fetches the schema and shows all tables, columns and indexes in the left panel. This schema information is injected into the OpenAI prompt, so the model knows the exact table structure and does not guess column names.
A screenshot demonstrates that the tool correctly understands the relationships among employee, dept_emp, department and salary tables, producing accurate JOIN conditions and WHERE filters.
Supported Databases
When creating a connection, the UI lists the supported database types. I tried both MySQL and PostgreSQL; the connection flow is identical—just fill in host, port, username and password.
TiDB Cloud and OceanBase are also integrated, which is convenient for users in China. Bytebase, which focuses on database DevOps, provides the necessary drivers and connection parameters.
Data Privacy
Connection configuration lives in the browser; clearing the cache removes it.
Only the schema structure is sent to OpenAI; table data never leaves the client.
The hosted version (sqlchat.ai) stores conversation records anonymously.
If privacy is a concern, the tool can be self‑hosted with Docker, keeping the API key and server under your control.
I appreciate this transparent design because it clearly states what data is transmitted.
Quick Start
Open https://sqlchat.ai, enter your OpenAI API key, add a database connection, and the service is up in about five minutes.
Note: If your database uses an IP whitelist, you must allow 0.0.0.0/0 because sqlchat.ai is hosted on Vercel with a dynamic IP. I initially missed this and could not connect to a local MySQL instance.
Docker Deployment
docker run --name sqlchat \
--platform linux/amd64 \
--env NEXTAUTH_SECRET="$(openssl rand -hex 5)" \
--env OPENAI_API_KEY=sk-xxxxxxxx \
-p 3000:3000 \
--hostname localhost \
sqlchat/sqlchatAfter the container starts, visit http://localhost:3000. When connecting to a database running on the host machine, use host.docker.internal as the host instead of localhost, because inside the container localhost refers to the container itself.
Modifying the Code
Clone the repository, copy .env.example to .env, add your OPENAI_API_KEY, then run pnpm i && pnpm dev. The project is built with Next.js and the core logic resides in src/store/conversation.ts, where prompt assembly and schema injection are implemented.
Author's Opinion
After several days of use I find that SQL Chat cannot replace Navicat entirely, but it shines for quick data exploration. My previous workflow involved opening Navicat, navigating to a table, inspecting columns, opening an editor, writing SQL, executing, reviewing results, and iterating—each step switching focus between tool interaction and business logic.
SQL Chat compresses the middle steps: I only describe what I need, and the tool returns both the SQL and the result, letting me stay focused on the business question rather than syntax details.
The tool has limitations: it does not handle complex stored procedures, performance tuning, or DDL changes. For routine data exploration, report extraction and business validation, however, its efficiency is noticeably higher.
Community and Maintenance
With 5.8K stars for a project created in March 2023, the community is active. Recent issues and pull requests added support for TiDB and OceanBase, and the Bytebase team maintains the repository diligently.
If you spend a lot of time writing SQL, I recommend spending ten minutes to try SQL Chat. It may not fully replace your existing tool, but in certain scenarios you’ll find yourself minimizing Navicat.
GitHub Repository
https://github.com/sqlchat/sqlchat
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
