OpenNavicat
CLI-First, AI-Native Database Management Tool
A free, open-source alternative to Navicat Premium, built with Python.
English
What is OpenNavicat?
OpenNavicat is a full-featured database management tool inspired by Navicat Premium. It provides both a CLI-first interface and an optional GUI (PySide6/Qt), with built-in AI capabilities for natural language queries, SQL optimization, and schema design.
Highlights
- CLI-First — Every operation has a CLI command. AI (LLM) can call CLI directly.
- AI-Native — Natural language to SQL, query optimization, auto-fix broken SQL, intelligent data generation.
- Full GUI — Navicat-like graphical interface with object browser, SQL editor, table designer, data viewer, BI dashboard, and more.
- Multi-Database — MySQL/MariaDB + PostgreSQL + SQLite + DuckDB + SQL Server + ClickHouse + Oracle + MongoDB + Redis. New engines are one registry row plus one connector module.
- Streaming I/O — batched import (CSV, TSV, JSON, JSONL, XLSX, Parquet) and export (CSV, TSV, JSON, Markdown, XLSX, SQL), so a large table never has to fit in memory.
- Privacy-First — Data masking for AI requests. Full offline mode with Ollama. Encrypted credential storage.
- Open Source — MIT License. Free for personal and commercial use.
Comparison
| Feature | OpenNavicat | Navicat Premium | DBeaver EE | DataGrip |
|---|---|---|---|---|
| Price | Free (MIT) | $599/yr | $299/yr | $199/yr |
| CLI-First | ✅ Native | ❌ | ❌ (dbeaver-cli limited) |
❌ |
| AI-Native (NL2SQL, optimize, fix) | ✅ Built-in | ✅ (paid add-on) | ❌ | 🟡 (AI Assistant) |
| ReAct Agent | ✅ Multi-step | ❌ | ❌ | ❌ |
| Schema RAG | ✅ Vector/keyword | ❌ | ❌ | ❌ |
| Cross-Platform | ✅ Win/Mac/Linux | ✅ Win/Mac | ✅ Win/Mac/Linux | ✅ Win/Mac/Linux |
| MySQL / PG / SQLite | ✅ | ✅ | ✅ | ✅ |
| MongoDB / Redis | ✅ | ✅ | ✅ | ✅ |
| DuckDB / SQL Server | ✅ | ✅ | ✅ | 🟡 |
| ClickHouse / Oracle | ✅ | 🟡 (Oracle) | ✅ | ✅ |
| BI Dashboard | ✅ Built-in (no ext libs) | ✅ | ❌ | ❌ |
| ER Model Designer | ✅ Conceptual/Logical/Physical | ✅ | ✅ | ✅ |
| Schema & Data Sync | ✅ MySQL↔PG | ✅ | ✅ | ❌ |
| Scheduled Automation | ✅ (APScheduler) | ✅ | ❌ | ❌ |
| SSH Tunnel | ✅ (asyncssh) | ✅ | ✅ | ✅ |
| i18n | ✅ zh_CN / en_US | ✅ 10+ langs | ✅ 20+ langs | ✅ 15+ langs |
| CLI ↔ GUI Bridge | 🚧 Planned | ❌ | ❌ | ❌ |
| Plugin System | ✅ Signed plugin packages (MVP) | ❌ | ✅ | ✅ |
| MCP Server | ✅ opennavicat mcp serve |
❌ | ❌ | ❌ |
| Open Source | ✅ MIT | ❌ Proprietary | 🟡 (Community edition) | ❌ Proprietary |
| Docker Image | ✅ ghcr.io | ❌ | ❌ | ❌ |
Quick Start
One-liner (auto-downloads latest CLI for your platform):
# Linux/macOS
curl -fsSL https://github.com/hackmagic/OpenNavicat/releases/latest/download/install.sh | bash
# Windows (PowerShell)
iwr -Uri https://github.com/hackmagic/OpenNavicat/releases/latest/download/install.ps1 | iex
Install via pip (recommended — includes both CLI and GUI):
pip install open-navicat
Or use Docker (CLI only, lightweight):
docker run --rm ghcr.io/hackmagic/opennavicat:latest conn list
Or download standalone executables from Releases:
| Package | Platform | Description | Size |
|---|---|---|---|
opennavicat-cli-windows-x64.exe |
Windows x64 | CLI only (no Qt) | 50.6 MB |
opennavicat-cli-macos-arm64 |
macOS arm64 | CLI only (no Qt) | 51.3 MB |
opennavicat-cli-linux-x64 |
Linux x64 | CLI only (no Qt) | 86.0 MB |
opennavicat-windows-x64.exe |
Windows x64 | Full GUI with PySide6 | 90.6 MB |
opennavicat-macos-arm64 |
macOS arm64 | Full GUI with PySide6 | 79.8 MB |
opennavicat-linux-x64 |
Linux x64 | Full GUI with PySide6 | 146.9 MB |
Sizes are the v0.9.0 release assets: onefile executables built with Python 3.12, self-extracting at startup to roughly twice their size in a temp directory. Linux builds are much larger than Windows and macOS because the DuckDB manylinux wheel alone is 20 MB versus 12 MB elsewhere.
Package managers: If you'd like to see OpenNavicat on Homebrew, Scoop, or Chocolatey, upvote or open an issue on GitHub!
# Add a connection
opennavicat conn add --name prod --host db.example.com --user root --test
# Activate connection
opennavicat conn open prod
# Natural language query
opennavicat query nl "show me the top 10 customers by revenue"
# Execute SQL
opennavicat query run "SELECT COUNT(*) FROM users"
# Launch GUI
opennavicat gui
AI Features
| Command | Description | Example |
|---|---|---|
query nl |
Natural language → SQL → Execute | query nl "users registered last 7 days" |
ai optimize |
SQL performance analysis | ai optimize "SELECT * FROM t WHERE YEAR(d)=2026" |
ai explain |
Plain language SQL explanation | ai explain "SELECT ... LEFT JOIN ..." |
ai fix |
Fix broken SQL queries | ai fix "SELCT * FORM users" |
ai chat |
Interactive data analysis | ai chat --conn prod |
ai agent |
ReAct multi-step reasoning | ai agent "query all active users" --db mydb |
ai config |
Configure AI provider | ai config --provider deepseek --api-key sk-xxx |
ai test |
Test AI connection | ai test |
ai chat-history |
View/clear chat history | ai chat-history show |
schema design |
AI schema design | schema design "blog: users, posts, comments" --deploy |
data generate |
Intelligent test data | data generate mydb.users --count 1000 |
CLI Commands
opennavicat
├── init Interactive setup wizard
├── conn Connection management
│ ├── list / add / edit / remove / test / open / close
│ ├── export / import / group
│
├── query SQL queries
│ ├── run / file / explain / nl / history / stream
│
├── plugin Plugin install, trust & lifecycle
│ ├── list / info / verify / inspect / install / uninstall
│ ├── enable / disable / keygen / key-list / key-add / key-remove
│
├── schema Schema management
│ ├── databases / list / show / create / diff / sync / design
│
├── data Data operations
│ ├── browse / export / import / generate / sync / compare
│
├── backup Backup & restore
│ ├── create / restore / list / delete / history / schedule
│ ├── jobs / job-remove / job-toggle
│
├── ai AI assistant (alias: ask)
│ ├── ask / optimize / explain / fix / chat / tables
│ ├── agent / config / test / chat-history
│
├── snippet Reusable SQL snippets (list / add / remove / show)
├── cloud Cloud database discovery (discover)
├── sql Dialect translation & optimization (translate / optimize)
├── template Community templates (list / generate)
├── mcp Serve these databases to an AI client (serve)
│
└── gui Launch GUI (optional)
Tech Stack
| Component | Technology |
|---|---|
| CLI Framework | Typer + Rich |
| GUI Framework | PySide6 (Qt 6) |
| Database Driver | aiomysql + asyncpg + aiosqlite + motor + redis.asyncio (async) |
| SSH Tunnel | asyncssh |
| SQL Parser | sqlparse |
| Password Encryption | cryptography (AES-GCM) |
| AI Engine | OpenAI / DeepSeek / Ollama |
| Scheduler | APScheduler |
| Packaging | PyInstaller |
Documentation
| Document | For | Description |
|---|---|---|
| CLI Reference | All users | Complete CLI command reference |
| AI Module | Developers | AI architecture, prompts, provider config |
| Architecture | Developers | System architecture, module design |
| Security | Ops/Security | Encryption, transport security |
| Privacy | All users | Data sent to AI, data masking, Ollama offline setup |
| Tutorials | All users | End-to-end walkthroughs |
| Development Guide | Contributors | Setup, code standards, testing |
| Data Flow | Developers | Data flow diagrams |
| Deployment | Ops | Packaging, CI/CD, Docker |
Contributing
We welcome contributions! Please read CONTRIBUTING.md first.
License
MIT License — Free for personal and commercial use.
简体中文
什么是 OpenNavicat?
OpenNavicat 是一款功能齐全的数据库管理工具,灵感来源于 Navicat Premium。它提供 CLI 优先 的操作方式和可选的 图形界面(PySide6/Qt),内置 AI 能力,支持自然语言查询、SQL 优化和结构设计。
核心特性
- CLI 优先 — 每个操作都有对应的 CLI 命令,AI (LLM) 可直接调用。
- AI 原生 — 自然语言转 SQL、查询优化、自动修复错误 SQL、智能数据生成。
- 完整 GUI — 类 Navicat 图形界面,包含对象浏览器、SQL 编辑器、表设计器、数据查看器、BI 看板等。
- 多数据库 — MySQL/MariaDB + PostgreSQL + SQLite + DuckDB + SQL Server + ClickHouse + Oracle + MongoDB + Redis。 新增引擎只需在注册表加一行 + 写一个 connector 模块。
- 流式导入导出 — 导入支持 CSV、TSV、JSON、JSONL、XLSX、Parquet,导出支持 CSV、TSV、JSON、Markdown、XLSX、SQL,均分批读写,大表不必一次性读进内存。
- 隐私优先 — AI 请求自动脱敏,支持 Ollama 全离线模式,凭据加密存储。
- 开源免费 — MIT 许可证,个人和商业用途均可免费使用。
功能对比
| 特性 | OpenNavicat | Navicat Premium | DBeaver EE | DataGrip |
|---|---|---|---|---|
| 价格 | 免费 (MIT) | $599/年 | $299/年 | $199/年 |
| CLI 优先 | ✅ 原生支持 | ❌ | ❌ (dbeaver-cli 有限) |
❌ |
| AI 原生 (NL2SQL、优化、修复) | ✅ 内置 | ✅ (付费附加) | ❌ | 🟡 (AI Assistant) |
| ReAct Agent | ✅ 多步推理 | ❌ | ❌ | ❌ |
| Schema RAG | ✅ 向量/关键词 | ❌ | ❌ | ❌ |
| 跨平台 | ✅ Win/Mac/Linux | ✅ Win/Mac | ✅ Win/Mac/Linux | ✅ Win/Mac/Linux |
| MySQL / PG / SQLite | ✅ | ✅ | ✅ | ✅ |
| MongoDB / Redis | ✅ | ✅ | ✅ | ✅ |
| DuckDB / SQL Server | ✅ | ✅ | ✅ | 🟡 |
| ClickHouse / Oracle | ✅ | 🟡 (Oracle) | ✅ | ✅ |
| BI 看板 | ✅ 内置 (零外部库) | ✅ | ❌ | ❌ |
| ER 模型设计器 | ✅ 概念/逻辑/物理 | ✅ | ✅ | ✅ |
| 结构 & 数据同步 | ✅ MySQL↔PG | ✅ | ✅ | ❌ |
| 定时自动化 | ✅ (APScheduler) | ✅ | ❌ | ❌ |
| SSH 隧道 | ✅ (asyncssh) | ✅ | ✅ | ✅ |
| 国际化 | ✅ 中/英 | ✅ 10+ 语言 | ✅ 20+ 语言 | ✅ 15+ 语言 |
| CLI ↔ GUI 联动 | 🚧 规划中 | ❌ | ❌ | ❌ |
| 插件系统 | ✅ 签名插件包 (MVP) | ❌ | ✅ | ✅ |
| MCP 服务 | ✅ opennavicat mcp serve |
❌ | ❌ | ❌ |
| 开源 | ✅ MIT | ❌ 专有 | 🟡 (社区版) | ❌ 专有 |
| Docker 镜像 | ✅ ghcr.io | ❌ | ❌ | ❌ |
快速上手
一行命令安装(自动下载最新版 CLI):
# Linux/macOS
curl -fsSL https://github.com/hackmagic/OpenNavicat/releases/latest/download/install.sh | bash
# Windows (PowerShell)
iwr -Uri https://github.com/hackmagic/OpenNavicat/releases/latest/download/install.ps1 | iex
pip 安装(推荐,包含 CLI 和 GUI):
pip install open-navicat
或用 Docker(纯 CLI,轻量):
docker run --rm ghcr.io/hackmagic/opennavicat:latest conn list
或下载独立可执行文件 — 从 Releases 获取:
| 包 | 平台 | 说明 | 体积 |
|---|---|---|---|
opennavicat-cli-windows-x64.exe |
Windows x64 | 纯 CLI,不含 Qt | 50.6 MB |
opennavicat-cli-macos-arm64 |
macOS arm64 | 纯 CLI,不含 Qt | 51.3 MB |
opennavicat-cli-linux-x64 |
Linux x64 | 纯 CLI,不含 Qt | 86.0 MB |
opennavicat-windows-x64.exe |
Windows x64 | 完整 GUI + PySide6 | 90.6 MB |
opennavicat-macos-arm64 |
macOS arm64 | 完整 GUI + PySide6 | 79.8 MB |
opennavicat-linux-x64 |
Linux x64 | 完整 GUI + PySide6 | 146.9 MB |
体积为 v0.9.0 发布产物实测值:Python 3.12 构建的单文件可执行程序,启动时自解压到临时目录,占用约为自身的两倍。Linux 版本显著大于 Windows 与 macOS——仅 DuckDB 的 manylinux wheel 就有 20 MB,其他平台为 12 MB。
# 添加连接
pip install open-navicat
# 添加连接
opennavicat conn add --name prod --host db.example.com --user root --test
# 激活连接
opennavicat conn open prod
# 自然语言查询
opennavicat query nl "上个月每个品类的销售额趋势"
# 执行 SQL
opennavicat query run "SELECT COUNT(*) FROM users"
# 启动图形界面
opennavicat gui
AI 功能
| 命令 | 功能 | 示例 |
|---|---|---|
query nl |
自然语言 → SQL → 执行 | query nl "最近7天注册用户" |
ai optimize |
SQL 性能分析 | ai optimize "SELECT * FROM t WHERE YEAR(d)=2026" |
ai explain |
SQL 作用解释 | ai explain "SELECT ... LEFT JOIN ..." |
ai fix |
修复报错 SQL | ai fix "SELCT * FORM users" |
ai chat |
交互式数据分析 | ai chat --conn prod |
ai agent |
ReAct 多步推理代理 | ai agent "查询所有活跃用户" --db mydb |
ai config |
配置 AI 提供商 | ai config --provider deepseek --api-key sk-xxx |
ai test |
测试 AI 连接 | ai test |
ai chat-history |
查看/清除聊天历史 | ai chat-history show |
schema design |
AI 设计表结构 | schema design "博客系统: 用户、文章、评论" --deploy |
data generate |
智能生成测试数据 | data generate mydb.users --count 1000 |
文档
| 文档 | 适合 | 内容 |
|---|---|---|
| CLI 参考手册 | 所有用户 | 全部 CLI 命令参考 |
| AI 模块设计 | 开发者 | AI 架构、Prompt、提供商配置 |
| 架构设计 | 开发者 | 系统架构 |
| 安全设计 | 运维/安全 | 加密、传输安全 |
| 隐私保护 | 所有用户 | AI 数据范围、脱敏、Ollama 离线方案 |
| 开发指南 | 贡献者 | 环境搭建、代码规范、测试 |
| 部署指南 | 运维 | 安装、打包、CI/CD、Docker |
技术栈
| 组件 | 技术 |
|---|---|
| CLI 框架 | Typer + Rich |
| GUI 框架 | PySide6 (Qt 6) |
| 数据库驱动 | aiomysql + asyncpg + aiosqlite + motor + redis.asyncio(异步) |
| SSH 隧道 | asyncssh |
| SQL 解析 | sqlparse |
| 密码加密 | cryptography (AES-GCM) |
| AI 引擎 | OpenAI / DeepSeek / Ollama |
| 定时任务 | APScheduler |
| 打包 | PyInstaller |
⚠️ Windows 用户请注意 OpenNavicat 是开源免费软件,暂未购买 EV 代码签名证书。首次运行 GUI 时 Windows SmartScreen 可能弹出 "Windows 已保护你的电脑" 警告。请点击 "更多信息" → "仍要运行" 放行。源码完全公开,请放心使用。
贡献
欢迎贡献!请先阅读 CONTRIBUTING.md(贡献指南)。
许可证
MIT 许可证 — 个人和商业用途均可免费使用。
Metadata
Release files for open-navicat 0.9.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_navicat-0.9.7.tar.gz | 463.3 kB | Without provenance | Details for open_navicat-0.9.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_navicat-0.9.7-py3-none-any.whl | Python 3 | none | any | Details for open_navicat-0.9.7-py3-none-any.whl |
Total release size: 1.0 MB
Security for open-navicat 0.9.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.