diff --git a/docs/app/[lang]/page.tsx b/docs/app/[lang]/page.tsx index 4056bfff97..362bf52e81 100644 --- a/docs/app/[lang]/page.tsx +++ b/docs/app/[lang]/page.tsx @@ -1,201 +1,155 @@ import Link from 'next/link'; import { - Database, - Zap, - Shield, - Bot, ArrowRight, - GitCompare, - Table, - Search, + Bot, + CheckCircle2, + Database, FileCode, - Import, + GitCompare, Network, + Search, + Shield, + Table, Terminal, + Zap, } from 'lucide-react'; -const stats = { +const languages = ['MySQL', 'PostgreSQL', 'SQLite', 'Redis', 'MongoDB', 'DuckDB', 'ClickHouse', 'SQL Server', 'Oracle']; + +const metrics = { en: [ - { value: '15 MB', label: 'Install Size' }, - { value: '25+', label: 'Databases' }, - { value: 'Desktop + Docker', label: 'Deployment' }, - { value: 'Built-in AI', label: 'Assistant' }, + { value: '~15 MB', label: 'desktop installer' }, + { value: '25+', label: 'database engines' }, + { value: '2 modes', label: 'desktop and Docker' }, ], cn: [ - { value: '15 MB', label: '安装体积' }, - { value: '25+', label: '支持数据库' }, - { value: '桌面 + Docker', label: '部署方式' }, - { value: '内置 AI', label: '智能助手' }, + { value: '~15 MB', label: '桌面安装包' }, + { value: '25+', label: '数据库引擎' }, + { value: '2 种模式', label: '桌面与 Docker' }, ], }; -const features = { +const workflows = { en: [ { icon: Terminal, - title: 'Query Editor', - desc: 'CodeMirror 6-powered SQL editor with syntax highlighting, smart autocomplete, and query history.', + title: 'Write and run SQL', + desc: 'A CodeMirror 6 editor with metadata-aware completion, formatting, history, and selected SQL execution.', href: '/en/docs/query-editor', }, { icon: Table, - title: 'Data Grid', - desc: 'Browse and edit data with virtual scrolling. Inline editing with SQL preview before saving.', + title: 'Browse and edit data', + desc: 'Virtualized grids, inline editing, WHERE/ORDER BY controls, SQL preview, and export tools.', href: '/en/docs/data-grid', }, { icon: Search, - title: 'Schema Browser', - desc: 'Tree view with search, pin, context menus, and column comments. Color-coded connections.', + title: 'Explore schemas', + desc: 'Navigate databases, schemas, tables, columns, indexes, foreign keys, and triggers from a focused sidebar.', href: '/en/docs/schema-browser', }, { icon: GitCompare, - title: 'Schema Diff & Sync', - desc: 'Compare schemas across databases and generate sync SQL. Dev vs Production in one click.', + title: 'Compare and migrate', + desc: 'Schema diff, table import, database export, SQL file execution, and cross-engine data transfer.', href: '/en/docs/schema-diff', }, - { - icon: Bot, - title: 'AI Assistant + MCP', - desc: 'Natural language to SQL, query optimization, error fixing. Let Claude/Cursor query your databases via MCP.', - href: '/en/docs/ai-assistant', - }, - { - icon: Import, - title: 'Data Transfer', - desc: 'Move data across database engines — MySQL to PostgreSQL, SQLite to SQL Server, and more.', - href: '/en/docs/data-transfer', - }, - { - icon: Network, - title: 'Field Lineage', - desc: 'Trace column relationships across foreign keys, views, and query history with confidence levels.', - href: '/en/docs/field-lineage', - }, - { - icon: FileCode, - title: 'Import & Export', - desc: 'Import CSV/JSON/Excel, export SQL dumps, run .sql files with smart statement splitting.', - href: '/en/docs/table-import', - }, ], cn: [ { icon: Terminal, - title: '查询编辑器', - desc: '基于 CodeMirror 6 的 SQL 编辑器,支持语法高亮、智能补全、JOIN 建议和查询历史。', + title: '编写与执行 SQL', + desc: 'CodeMirror 6 编辑器,支持元数据补全、格式化、查询历史和选中 SQL 执行。', href: '/cn/docs/query-editor', }, { icon: Table, - title: '数据表格', - desc: '虚拟滚动浏览大数据量。行内编辑,保存前可预览将要执行的 SQL 语句。', + title: '浏览与编辑数据', + desc: '虚拟滚动表格、行内编辑、WHERE/ORDER BY 控制、SQL 预览和导出工具。', href: '/cn/docs/data-grid', }, { icon: Search, - title: '结构浏览', - desc: '树形视图,支持搜索、置顶、右键菜单、字段注释显示和连接颜色标记。', + title: '浏览数据库结构', + desc: '在侧边栏中查看数据库、Schema、表、字段、索引、外键和触发器。', href: '/cn/docs/schema-browser', }, { icon: GitCompare, - title: 'Schema 对比与同步', - desc: '跨数据库结构对比,自动生成同步 SQL。开发环境 vs 生产环境,一键搞定。', + title: '对比与迁移', + desc: 'Schema 对比、表导入、数据库导出、SQL 文件执行和跨引擎数据传输。', href: '/cn/docs/schema-diff', }, - { - icon: Bot, - title: 'AI 助手 + MCP', - desc: '自然语言转 SQL、查询优化、错误修复。通过 MCP 让 Claude/Cursor 直接查询你的数据库。', - href: '/cn/docs/ai-assistant', - }, - { - icon: Import, - title: '数据传输', - desc: '跨引擎数据迁移 — MySQL 到 PostgreSQL、SQLite 到 SQL Server,自动处理类型映射。', - href: '/cn/docs/data-transfer', - }, - { - icon: Network, - title: '字段血缘', - desc: '追踪外键、视图、查询历史中的字段关联关系,标注置信度,数据治理必备。', - href: '/cn/docs/field-lineage', - }, - { - icon: FileCode, - title: '导入与导出', - desc: '导入 CSV/JSON/Excel,导出 SQL 文件,执行 .sql 脚本,智能语句分割。', - href: '/cn/docs/table-import', - }, ], }; -const databases = [ - 'MySQL', 'PostgreSQL', 'SQLite', 'Redis', 'MongoDB', - 'DuckDB', 'ClickHouse', 'SQL Server', 'Oracle', 'Elasticsearch', - 'MariaDB', 'TiDB', 'OceanBase', 'CockroachDB', 'StarRocks', - 'Doris', 'DM', 'GaussDB', 'Redshift', 'TDengine', -]; - -const comparison = { - en: { - title: 'Why DBX?', - headers: ['', 'DBX', 'DBeaver', 'Navicat', 'TablePlus'], - rows: [ - ['Install Size', '~15 MB', '~300 MB', '~200 MB', '~80 MB'], - ['Price', 'Free (AGPL)', 'Free / $230', '$180+', '$99+'], - ['Database Support', '25+', '80+', '15+', '20+'], - ['Built-in AI', 'Yes', 'No', 'Yes', 'No'], - ['MCP Integration', 'Yes', 'No', 'No', 'No'], - ['Docker Self-Host', 'Yes', 'No', 'No', 'No'], - ['Field Lineage', 'Yes', 'No', 'No', 'No'], - ], - }, - cn: { - title: '为什么选择 DBX?', - headers: ['', 'DBX', 'DBeaver', 'Navicat', 'TablePlus'], - rows: [ - ['安装体积', '~15 MB', '~300 MB', '~200 MB', '~80 MB'], - ['价格', '免费 (AGPL)', '免费 / $230', '$180+', '$99+'], - ['数据库支持', '25+', '80+', '15+', '20+'], - ['内置 AI', '有', '无', '有', '无'], - ['MCP 集成', '有', '无', '无', '无'], - ['Docker 自托管', '有', '无', '无', '无'], - ['字段血缘', '有', '无', '无', '无'], - ], - }, +const capabilities = { + en: [ + { icon: Database, label: 'Native Rust drivers, no JDBC runtime' }, + { icon: Shield, label: 'SSH tunnels, encrypted config export, destructive action guards' }, + { icon: Bot, label: 'AI assistant plus MCP server for Claude Code, Cursor, and agents' }, + { icon: Network, label: 'ER diagrams, schema diff, and field lineage for deeper analysis' }, + { icon: FileCode, label: 'CSV, Excel, SQL files, full exports, and cross-engine transfer' }, + { icon: Zap, label: 'Desktop app and self-hosted web deployment from the same project' }, + ], + cn: [ + { icon: Database, label: 'Rust 原生驱动,不依赖 JDBC 运行时' }, + { icon: Shield, label: 'SSH 隧道、加密配置导出、危险操作确认' }, + { icon: Bot, label: '内置 AI 助手,以及面向 Claude Code、Cursor 的 MCP Server' }, + { icon: Network, label: 'ER 图、Schema 对比、字段血缘,覆盖更深层分析场景' }, + { icon: FileCode, label: 'CSV、Excel、SQL 文件、完整导出和跨引擎传输' }, + { icon: Zap, label: '桌面应用与自托管 Web 部署来自同一个项目' }, + ], }; const i18nText = { en: { - heroTitle: '25+ Databases.', - heroTitle2: 'One 15 MB App.', - heroSubtitle: 'Open-source database management tool with built-in AI assistant. Desktop & Docker self-hosting, powered by Tauri 2 and Rust.', - ctaDownload: 'Download', - ctaDocs: 'Read the Docs', - featuresTitle: 'Everything You Need', - featuresSubtitle: 'A complete toolkit for database management, from daily queries to cross-engine migration.', - dbTitle: 'Supported Databases', - dbSubtitle: 'Native Rust drivers, no JDBC. MySQL/PostgreSQL compatible databases work out of the box.', - andMore: 'and more...', - footerCta: 'Ready to try?', - footerCtaSub: 'Download DBX or deploy with Docker in seconds.', + navDocs: 'Docs', + navCommunity: 'Community', + lang: '中文', + eyebrow: 'Open-source database workspace', + heroTitle: 'A focused database client for daily work.', + heroSubtitle: + 'DBX brings connections, SQL editing, data grids, schema tools, AI assistance, and self-hosted access into one lightweight product.', + download: 'Download DBX', + readDocs: 'Read the docs', + installLabel: 'Install on macOS', + installCommand: 'brew install --cask t8y2/tap/dbx', + docsStart: 'Start here', + docsStartDesc: 'Install DBX, create your first connection, and learn the main workflow.', + workflowsTitle: 'Core workflows', + workflowsDesc: 'The docs are organized around what you actually do in a database client.', + supportTitle: 'Database coverage', + supportDesc: 'SQL, NoSQL, embedded databases, and popular MySQL/PostgreSQL-compatible engines.', + capabilitiesTitle: 'Built for real database work', + footerTitle: 'Ready to try DBX?', + footerDesc: 'Use the desktop app for local work, or deploy the Docker version for browser-based access.', + release: 'Latest release', + docker: 'Docker setup', }, cn: { - heroTitle: '25+ 数据库', - heroTitle2: '一个 15 MB 的应用', - heroSubtitle: '开源数据库管理工具,内置 AI 助手。桌面应用 + Docker 自托管,基于 Tauri 2 和 Rust 构建。', - ctaDownload: '下载', - ctaDocs: '查看文档', - featuresTitle: '功能一览', - featuresSubtitle: '从日常查询到跨引擎迁移,一站式数据库管理工具。', - dbTitle: '支持的数据库', - dbSubtitle: 'Rust 原生驱动,无 JDBC。MySQL / PostgreSQL 兼容数据库开箱即用。', - andMore: '更多...', - footerCta: '准备好了吗?', - footerCtaSub: '下载 DBX 或用 Docker 秒级部署。', + navDocs: '文档', + navCommunity: '社区', + lang: 'English', + eyebrow: '开源数据库工作台', + heroTitle: '专注日常工作的数据库客户端。', + heroSubtitle: 'DBX 将连接管理、SQL 编辑、数据表格、结构工具、AI 助手和自托管访问放进一个轻量产品里。', + download: '下载 DBX', + readDocs: '查看文档', + installLabel: 'macOS 安装', + installCommand: 'brew install --cask t8y2/tap/dbx', + docsStart: '从这里开始', + docsStartDesc: '安装 DBX、创建第一个连接,并了解主要工作流。', + workflowsTitle: '核心工作流', + workflowsDesc: '文档围绕数据库客户端里的真实任务组织,而不是堆功能清单。', + supportTitle: '数据库覆盖', + supportDesc: '覆盖 SQL、NoSQL、嵌入式数据库,以及常见 MySQL/PostgreSQL 兼容数据库。', + capabilitiesTitle: '面向真实数据库工作的能力', + footerTitle: '准备试试 DBX?', + footerDesc: '本地工作使用桌面版,需要浏览器访问时部署 Docker 版。', + release: '最新版本', + docker: 'Docker 部署', }, }; @@ -207,13 +161,12 @@ export default async function LandingPage({ const { lang } = await params; const l = lang === 'cn' ? 'cn' : 'en'; const t = i18nText[l]; - const feat = features[l]; - const stat = stats[l]; - const comp = comparison[l]; + const workflowItems = workflows[l]; + const capabilityItems = capabilities[l]; + const metricItems = metrics[l]; return (
- {/* Navbar */} - {/* Hero */}
-
-

- {t.heroTitle} -
- {t.heroTitle2} -

-

{t.heroSubtitle}

+
+
{t.eyebrow}
+

{t.heroTitle}

+

{t.heroSubtitle}

- - {t.ctaDownload} + + {t.download} + - - {t.ctaDocs} + + {t.readDocs}
+
+ {t.installLabel} + {t.installCommand} +
-
- DBX Screenshot +
+
+ + + +
+ DBX product screenshot
- {/* Stats */} -
- {stat.map((s) => ( -
-
{s.value}
-
{s.label}
+
+ {metricItems.map((item) => ( +
+ {item.value} + {item.label}
))}
- {/* Features */} +
+
+

{t.docsStart}

+

{t.docsStartDesc}

+
+ + {t.readDocs} + + +
+
-

{t.featuresTitle}

-

{t.featuresSubtitle}

-
- {feat.map((f) => ( - -
- -
-

{f.title}

-

{f.desc}

+
+

{t.workflowsTitle}

+

{t.workflowsDesc}

+
+
+ {workflowItems.map((item) => ( + + +

{item.title}

+

{item.desc}

+ + {t.readDocs} + + ))}
- {/* Database Logos */} +
+
+

{t.supportTitle}

+

{t.supportDesc}

+
+
+ {languages.map((db) => ( + + + {db} + + ))} + + more +
+
+
-

{t.dbTitle}

-

{t.dbSubtitle}

-
- {databases.map((db) => ( -
- - {db} +
+

{t.capabilitiesTitle}

+
+
+ {capabilityItems.map((item) => ( +
+ + {item.label}
))} -
- {t.andMore} -
- {/* Comparison */} -
-

{comp.title}

-
- - - - {comp.headers.map((h, i) => ( - - ))} - - - - {comp.rows.map((row, ri) => ( - - {row.map((cell, ci) => ( - - ))} - - ))} - -
- {h} -
- {cell} -
+
+
+

{t.footerTitle}

+

{t.footerDesc}

+
+
+ {t.release} + {t.docker}
- - {/* Screenshots */} -
-
-
- DBX Light Mode -
-
- DBX ER Diagram -
-
-
- - {/* Footer CTA */} -
-

{t.footerCta}

-

{t.footerCtaSub}

-
- - {t.ctaDownload} - - - {t.ctaDocs} - -
-
- - {/* Footer */} -
); } diff --git a/docs/app/global.css b/docs/app/global.css index b692b1d211..caa82213b1 100644 --- a/docs/app/global.css +++ b/docs/app/global.css @@ -2,432 +2,572 @@ @import 'fumadocs-ui/css/ocean.css'; @import 'fumadocs-ui/css/preset.css'; -/* ===== Landing Page Styles ===== */ - .landing { - --landing-max: 1200px; - --landing-accent: #3b82f6; - --landing-accent-dark: #2563eb; + --landing-max: 1180px; + --landing-panel: color-mix(in srgb, var(--color-fd-card) 82%, transparent); + --landing-panel-strong: color-mix(in srgb, var(--color-fd-card) 94%, var(--color-fd-background)); + --landing-line: color-mix(in srgb, var(--color-fd-border) 86%, transparent); + --landing-soft: color-mix(in srgb, var(--color-fd-muted) 54%, transparent); + --landing-blue: #2563eb; + --landing-green: #0f9f6e; + min-height: 100vh; color: var(--color-fd-foreground); - background: var(--color-fd-background); + background: + linear-gradient(180deg, color-mix(in srgb, var(--color-fd-muted) 28%, transparent), transparent 420px), + var(--color-fd-background); +} + +.landing a { + text-decoration: none; } -/* Navbar */ .landing-nav { position: sticky; top: 0; - z-index: 50; - backdrop-filter: blur(12px); - background: color-mix(in srgb, var(--color-fd-background) 80%, transparent); - border-bottom: 1px solid var(--color-fd-border); + z-index: 20; + border-bottom: 1px solid var(--landing-line); + background: color-mix(in srgb, var(--color-fd-background) 88%, transparent); + backdrop-filter: blur(18px); } .landing-nav-inner { - max-width: var(--landing-max); - margin: 0 auto; - padding: 0.875rem 1.5rem; display: flex; align-items: center; justify-content: space-between; + max-width: var(--landing-max); + height: 64px; + margin: 0 auto; + padding: 0 28px; +} + +.landing-logo, +.landing-nav-links, +.landing-hero-cta, +.landing-inline-link, +.landing-db-list span, +.landing-final-actions, +.landing-capability { + display: flex; + align-items: center; } .landing-logo { - display: flex; - align-items: center; - gap: 0.5rem; - font-weight: 700; - font-size: 1.125rem; + gap: 10px; color: var(--color-fd-foreground); - text-decoration: none; + font-size: 15px; + font-weight: 700; +} + +.landing-logo img { + border-radius: 7px; } .landing-nav-links { - display: flex; - align-items: center; - gap: 1.5rem; + gap: 4px; } .landing-nav-links a { + border-radius: 7px; + padding: 8px 11px; color: var(--color-fd-muted-foreground); - text-decoration: none; - font-size: 0.875rem; + font-size: 13px; font-weight: 500; - transition: color 0.15s; } .landing-nav-links a:hover { + background: var(--landing-soft); color: var(--color-fd-foreground); } .landing-lang-switch { - padding: 0.25rem 0.75rem; - border: 1px solid var(--color-fd-border); - border-radius: 6px; - font-size: 0.75rem !important; + margin-left: 6px; + border: 1px solid var(--landing-line); } -/* Hero */ .landing-hero { + display: grid; + grid-template-columns: minmax(0, 0.9fr) minmax(500px, 1.1fr); + gap: 42px; + align-items: center; max-width: var(--landing-max); margin: 0 auto; - padding: 5rem 1.5rem 3rem; - display: flex; - flex-direction: column; - align-items: center; - text-align: center; - gap: 3rem; + padding: 82px 28px 36px; } -.landing-hero-title { - font-size: 3.5rem; - font-weight: 800; - line-height: 1.1; - letter-spacing: -0.03em; +.landing-hero-copy { + max-width: 520px; } -.landing-gradient { - background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%); - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - background-clip: text; -} - -.landing-hero-sub { - max-width: 600px; - margin: 1.25rem auto 0; - font-size: 1.125rem; - line-height: 1.6; +.landing-eyebrow { + width: max-content; + border: 1px solid var(--landing-line); + border-radius: 999px; + margin-bottom: 18px; + padding: 6px 10px; color: var(--color-fd-muted-foreground); + font-size: 12px; + font-weight: 600; +} + +.landing-hero h1 { + max-width: 620px; + margin: 0; + font-size: clamp(38px, 4.6vw, 58px); + font-weight: 760; + letter-spacing: 0; + line-height: 1.06; +} + +.landing-hero p { + max-width: 560px; + margin: 22px 0 0; + color: var(--color-fd-muted-foreground); + font-size: 17px; + line-height: 1.72; } .landing-hero-cta { - display: flex; - gap: 0.75rem; - margin-top: 2rem; + gap: 10px; flex-wrap: wrap; + margin-top: 30px; +} + +.landing-btn-primary, +.landing-btn-secondary, +.landing-final-actions a { + display: inline-flex; + align-items: center; justify-content: center; + min-height: 42px; + border-radius: 7px; + padding: 0 15px; + font-size: 14px; + font-weight: 650; } .landing-btn-primary { - display: inline-flex; - align-items: center; - gap: 0.5rem; - padding: 0.75rem 1.75rem; - background: var(--landing-accent); - color: #fff; - border-radius: 8px; - font-weight: 600; - font-size: 0.9375rem; - text-decoration: none; - transition: background 0.15s, transform 0.1s; + gap: 8px; + background: var(--color-fd-foreground); + color: var(--color-fd-background); } .landing-btn-primary:hover { - background: var(--landing-accent-dark); - transform: translateY(-1px); + opacity: 0.88; } -.landing-btn-secondary { - display: inline-flex; +.landing-btn-secondary, +.landing-final-actions a { + border: 1px solid var(--landing-line); + background: var(--landing-panel); + color: var(--color-fd-foreground); +} + +.landing-btn-secondary:hover, +.landing-final-actions a:hover { + border-color: color-mix(in srgb, var(--color-fd-muted-foreground) 42%, var(--landing-line)); + background: var(--landing-panel-strong); +} + +.landing-install { + display: grid; + grid-template-columns: max-content minmax(0, 1fr); + gap: 12px; align-items: center; - gap: 0.5rem; - padding: 0.75rem 1.75rem; - border: 1px solid var(--color-fd-border); - color: var(--color-fd-foreground); + max-width: 500px; + border: 1px solid var(--landing-line); border-radius: 8px; + margin-top: 18px; + padding: 10px 12px; + background: color-mix(in srgb, var(--color-fd-background) 72%, transparent); +} + +.landing-install span { + color: var(--color-fd-muted-foreground); + font-size: 12px; font-weight: 600; - font-size: 0.9375rem; - text-decoration: none; - transition: border-color 0.15s, background 0.15s; } -.landing-btn-secondary:hover { - background: var(--color-fd-accent); - border-color: var(--color-fd-muted-foreground); -} - -.landing-hero-image { - width: 100%; - max-width: 1000px; -} - -.landing-hero-image img { - width: 100%; - border-radius: 12px; - border: 1px solid var(--color-fd-border); - box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.3); -} - -/* Stats */ -.landing-stats { - max-width: var(--landing-max); - margin: 0 auto; - padding: 3rem 1.5rem; - display: grid; - grid-template-columns: repeat(4, 1fr); - gap: 1.5rem; -} - -.landing-stat { - text-align: center; - padding: 1.5rem; - border-radius: 12px; - background: var(--color-fd-card); - border: 1px solid var(--color-fd-border); -} - -.landing-stat-value { - font-size: 1.75rem; - font-weight: 800; - color: var(--landing-accent); -} - -.landing-stat-label { - margin-top: 0.25rem; - font-size: 0.875rem; - color: var(--color-fd-muted-foreground); -} - -/* Sections */ -.landing-section { - max-width: var(--landing-max); - margin: 0 auto; - padding: 4rem 1.5rem; -} - -.landing-section-title { - font-size: 2rem; - font-weight: 700; - text-align: center; - letter-spacing: -0.02em; -} - -.landing-section-sub { - text-align: center; - color: var(--color-fd-muted-foreground); - margin-top: 0.5rem; - font-size: 1rem; -} - -/* Feature Cards */ -.landing-features-grid { - display: grid; - grid-template-columns: repeat(4, 1fr); - gap: 1rem; - margin-top: 2.5rem; -} - -.landing-feature-card { - padding: 1.5rem; - border-radius: 12px; - border: 1px solid var(--color-fd-border); - background: var(--color-fd-card); - text-decoration: none; +.landing-install code { + overflow: hidden; color: var(--color-fd-foreground); - transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s; + font-size: 12px; + text-overflow: ellipsis; + white-space: nowrap; } -.landing-feature-card:hover { - border-color: var(--landing-accent); - box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1); - transform: translateY(-2px); -} - -.landing-feature-icon { - display: inline-flex; - padding: 0.5rem; - border-radius: 8px; - background: color-mix(in srgb, var(--landing-accent) 12%, transparent); - color: var(--landing-accent); - margin-bottom: 0.75rem; -} - -.landing-feature-card h3 { - font-size: 1rem; - font-weight: 600; - margin-bottom: 0.375rem; -} - -.landing-feature-card p { - font-size: 0.8125rem; - line-height: 1.5; - color: var(--color-fd-muted-foreground); -} - -/* Database Badges */ -.landing-db-grid { - display: flex; - flex-wrap: wrap; - gap: 0.625rem; - justify-content: center; - margin-top: 2rem; - max-width: 800px; - margin-left: auto; - margin-right: auto; -} - -.landing-db-badge { - display: inline-flex; - align-items: center; - gap: 0.375rem; - padding: 0.5rem 0.875rem; - border-radius: 999px; - border: 1px solid var(--color-fd-border); - font-size: 0.8125rem; - font-weight: 500; - color: var(--color-fd-muted-foreground); - background: var(--color-fd-card); - transition: border-color 0.15s; -} - -.landing-db-badge:hover { - border-color: var(--landing-accent); - color: var(--color-fd-foreground); -} - -.landing-db-more { - border-style: dashed; -} - -/* Comparison Table */ -.landing-comparison { - margin-top: 2rem; - overflow-x: auto; -} - -.landing-comparison table { - width: 100%; - border-collapse: collapse; - font-size: 0.875rem; -} - -.landing-comparison th, -.landing-comparison td { - padding: 0.75rem 1rem; - text-align: left; - border-bottom: 1px solid var(--color-fd-border); -} - -.landing-comparison th { - font-weight: 600; - color: var(--color-fd-muted-foreground); - font-size: 0.8125rem; - text-transform: uppercase; - letter-spacing: 0.05em; -} - -.landing-comparison td:first-child { - font-weight: 500; -} - -.landing-highlight-col { - background: color-mix(in srgb, var(--landing-accent) 6%, transparent); - color: var(--landing-accent) !important; - font-weight: 600 !important; -} - -/* Screenshots */ -.landing-screenshots { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 1.5rem; -} - -.landing-screenshot-item img { - width: 100%; +.landing-product { + position: relative; + overflow: hidden; + border: 1px solid var(--landing-line); border-radius: 10px; - border: 1px solid var(--color-fd-border); - transition: transform 0.2s; + background: #0d1117; + box-shadow: 0 26px 74px rgba(0, 0, 0, 0.22); } -.landing-screenshot-item img:hover { - transform: scale(1.02); +.landing-window-bar { + display: flex; + gap: 7px; + height: 34px; + align-items: center; + border-bottom: 1px solid rgba(255, 255, 255, 0.08); + padding: 0 13px; + background: #111827; } -/* Footer CTA */ -.landing-footer-cta { - text-align: center; - padding: 5rem 1.5rem; - margin: 2rem auto; - max-width: var(--landing-max); - border-radius: 16px; - background: linear-gradient(135deg, color-mix(in srgb, var(--landing-accent) 8%, transparent), color-mix(in srgb, #8b5cf6 8%, transparent)); - border: 1px solid var(--color-fd-border); +.landing-window-bar span { + width: 10px; + height: 10px; + border-radius: 50%; + background: rgba(255, 255, 255, 0.22); } -.landing-footer-cta h2 { - font-size: 2rem; - font-weight: 700; +.landing-window-bar span:nth-child(1) { + background: #ff5f57; } -.landing-footer-cta p { - color: var(--color-fd-muted-foreground); - margin-top: 0.5rem; +.landing-window-bar span:nth-child(2) { + background: #ffbd2e; } -/* Footer */ -.landing-footer { - border-top: 1px solid var(--color-fd-border); - padding: 1.5rem; +.landing-window-bar span:nth-child(3) { + background: #28c840; } -.landing-footer-inner { +.landing-product img { + display: block; + width: 100%; + aspect-ratio: 16 / 10; + object-fit: cover; + object-position: left top; +} + +.landing-metrics, +.landing-doc-start, +.landing-section, +.landing-final { max-width: var(--landing-max); margin: 0 auto; + padding-right: 28px; + padding-left: 28px; +} + +.landing-metrics { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 0; + padding-top: 18px; + padding-bottom: 44px; +} + +.landing-metrics div { + border-top: 1px solid var(--landing-line); + padding: 22px 22px 0 0; +} + +.landing-metrics strong { + display: block; + color: var(--color-fd-foreground); + font-size: 24px; + font-weight: 720; +} + +.landing-metrics span { + display: block; + margin-top: 4px; + color: var(--color-fd-muted-foreground); + font-size: 13px; +} + +.landing-doc-start { display: flex; align-items: center; justify-content: space-between; + gap: 22px; + border-top: 1px solid var(--landing-line); + border-bottom: 1px solid var(--landing-line); + padding-top: 24px; + padding-bottom: 24px; } -.landing-footer-brand { +.landing-doc-start h2, +.landing-section-heading h2, +.landing-final h2 { + margin: 0; + font-size: 25px; + font-weight: 720; + letter-spacing: 0; +} + +.landing-doc-start p, +.landing-section-heading p, +.landing-final p { + margin: 8px 0 0; + color: var(--color-fd-muted-foreground); + font-size: 14px; + line-height: 1.65; +} + +.landing-inline-link { + flex-shrink: 0; + gap: 7px; + color: var(--landing-blue); + font-size: 14px; + font-weight: 650; +} + +.landing-inline-link:hover { + color: color-mix(in srgb, var(--landing-blue) 78%, var(--color-fd-foreground)); +} + +.landing-section { + padding-top: 70px; + padding-bottom: 4px; +} + +.landing-section-heading { + display: grid; + grid-template-columns: minmax(220px, 0.42fr) minmax(0, 0.58fr); + gap: 36px; + align-items: end; + margin-bottom: 22px; +} + +.landing-workflow-grid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + border: 1px solid var(--landing-line); + border-radius: 10px; + overflow: hidden; + background: var(--landing-panel); +} + +.landing-workflow-card { + min-height: 250px; + border-right: 1px solid var(--landing-line); + padding: 24px; + color: var(--color-fd-foreground); + transition: + background 0.16s ease, + transform 0.16s ease; +} + +.landing-workflow-card:last-child { + border-right: 0; +} + +.landing-workflow-card:hover { + background: var(--landing-panel-strong); + transform: translateY(-1px); +} + +.landing-workflow-card > svg { + color: var(--landing-blue); +} + +.landing-workflow-card h3 { + margin: 18px 0 0; + font-size: 16px; + font-weight: 700; +} + +.landing-workflow-card p { + margin: 10px 0 0; + color: var(--color-fd-muted-foreground); + font-size: 13px; + line-height: 1.62; +} + +.landing-workflow-card span { + display: inline-flex; + align-items: center; + gap: 6px; + margin-top: 18px; + color: var(--color-fd-foreground); + font-size: 13px; + font-weight: 650; +} + +.landing-support { + display: grid; + grid-template-columns: minmax(260px, 0.42fr) minmax(0, 0.58fr); + gap: 36px; + align-items: start; +} + +.landing-support .landing-section-heading { + display: block; + margin-bottom: 0; +} + +.landing-db-list { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.landing-db-list span { + gap: 7px; + border: 1px solid var(--landing-line); + border-radius: 7px; + min-height: 34px; + padding: 0 11px; + background: var(--landing-panel); + color: var(--color-fd-muted-foreground); + font-size: 13px; + font-weight: 600; +} + +.landing-db-list svg { + color: var(--landing-green); +} + +.landing-capability-grid { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 10px; +} + +.landing-capability { + gap: 10px; + min-height: 72px; + border: 1px solid var(--landing-line); + border-radius: 8px; + padding: 14px 15px; + background: var(--landing-panel); +} + +.landing-capability svg { + flex: 0 0 auto; + color: var(--landing-blue); +} + +.landing-capability span { + color: var(--color-fd-foreground); + font-size: 13px; + font-weight: 560; + line-height: 1.45; +} + +.landing-final { display: flex; align-items: center; - gap: 0.5rem; - font-weight: 600; - font-size: 0.875rem; + justify-content: space-between; + gap: 24px; + border: 1px solid var(--landing-line); + border-radius: 10px; + margin-top: 72px; + margin-bottom: 56px; + padding-top: 30px; + padding-bottom: 30px; + background: var(--landing-panel); } -.landing-footer-links { - display: flex; - gap: 1.5rem; +.landing-final-actions { + gap: 10px; + flex-wrap: wrap; + justify-content: flex-end; } -.landing-footer-links a { - color: var(--color-fd-muted-foreground); - text-decoration: none; - font-size: 0.8125rem; - transition: color 0.15s; -} - -.landing-footer-links a:hover { - color: var(--color-fd-foreground); -} - -/* Responsive */ -@media (max-width: 768px) { - .landing-hero-title { - font-size: 2.25rem; +@media (max-width: 1040px) { + .landing-hero { + grid-template-columns: 1fr; + padding-top: 56px; } - .landing-stats { - grid-template-columns: repeat(2, 1fr); + .landing-hero-copy { + max-width: 760px; } - .landing-features-grid { + .landing-product { + max-width: 860px; + } + + .landing-workflow-grid, + .landing-capability-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .landing-workflow-card:nth-child(2n) { + border-right: 0; + } + + .landing-workflow-card:nth-child(-n + 2) { + border-bottom: 1px solid var(--landing-line); + } +} + +@media (max-width: 760px) { + .landing-nav-inner { + height: auto; + min-height: 58px; + padding: 10px 18px; + } + + .landing-nav-links a:not(.landing-lang-switch) { + display: none; + } + + .landing-hero, + .landing-metrics, + .landing-doc-start, + .landing-section, + .landing-final { + padding-right: 18px; + padding-left: 18px; + } + + .landing-hero { + padding-top: 44px; + } + + .landing-hero h1 { + font-size: 42px; + line-height: 1.05; + } + + .landing-install { + grid-template-columns: 1fr; + gap: 5px; + } + + .landing-metrics { + grid-template-columns: 1fr; + padding-bottom: 32px; + } + + .landing-metrics div { + padding: 16px 0; + } + + .landing-doc-start, + .landing-section-heading, + .landing-support, + .landing-final { + display: block; + } + + .landing-inline-link { + margin-top: 16px; + } + + .landing-workflow-grid, + .landing-capability-grid { grid-template-columns: 1fr; } - .landing-screenshots { - grid-template-columns: 1fr; + .landing-workflow-card { + min-height: 0; + border-right: 0; + border-bottom: 1px solid var(--landing-line); } - .landing-comparison { - font-size: 0.8125rem; + .landing-workflow-card:last-child { + border-bottom: 0; } -} -@media (min-width: 769px) and (max-width: 1024px) { - .landing-features-grid { - grid-template-columns: repeat(2, 1fr); + .landing-db-list, + .landing-capability-grid, + .landing-final-actions { + margin-top: 18px; } } diff --git a/docs/content/docs/ai-assistant.cn.mdx b/docs/content/docs/ai-assistant.cn.mdx index 923014e79f..a2a8667924 100644 --- a/docs/content/docs/ai-assistant.cn.mdx +++ b/docs/content/docs/ai-assistant.cn.mdx @@ -1,122 +1,130 @@ --- title: AI 助手 -description: 内置 AI 助手,自然语言转 SQL、查询优化、错误修复,支持 Claude/OpenAI/自定义端点。 +description: 配置 AI 供应商后,在 DBX 中生成 SQL、解释查询、优化语句并辅助修复错误。 --- - -内置 AI 助手,无需额外安装插件。自然语言描述需求,AI 帮你生成 SQL、优化查询、修复错误。 +AI 助手用于辅助 SQL 工作。它会结合当前连接的数据库元数据理解表结构和字段,再根据你的描述生成 SQL、解释查询、给出优化建议或帮助修复错误。 + + +AI 生成的 SQL 不会自动执行。请在执行前检查表名、字段名、筛选条件和影响范围,尤其是在生产环境连接上。 -DBX 内置 AI 助手,深度集成数据库元数据,能根据你的表结构和字段生成精准的 SQL。 - -![DBX AI 助手](/screenshot-ai.jpg) - -## 设置 +## 配置 ### 打开设置 - 点击工具栏的 **设置** 图标。 + + 进入 DBX 设置页,找到 AI 相关配置。 - ### 选择 AI 供应商 - 进入 **AI 设置**,选择供应商。 + ### 选择供应商 + + 选择 Anthropic、OpenAI 或兼容 OpenAI API 的自定义端点。 - ### 输入 API Key - 填入你的 API Key(如使用自定义端点,还需填入端点 URL)。 + ### 填写凭据 + + 输入 API Key。使用自定义端点时,还需要填写接口地址和模型名称。 - ### 选择模型并开始使用 - 选择一个模型,完成设置。回到编辑器即可使用 AI 功能。 + ### 保存并测试 + + 保存配置后回到编辑器,尝试用自然语言生成一条简单查询。 -## 核心功能 + +如果没有配置 API Key,AI 功能应向用户提示需要先完成设置,而不是静默失败。 + -### 自然语言转 SQL +## 常见用法 -用自然语言描述你的查询需求,AI 助手根据数据库结构生成对应的 SQL: +### 生成 SQL -> **你说:** "查看最近 10 个订单金额最高的客户" -> -> **AI 生成:** -> ```sql -> SELECT c.name, SUM(o.amount) AS total_amount -> FROM customers c -> JOIN orders o ON c.id = o.customer_id -> WHERE o.created_at >= NOW() - INTERVAL 30 DAY -> GROUP BY c.id, c.name -> ORDER BY total_amount DESC -> LIMIT 10; -> ``` +用自然语言描述目标,AI 会结合当前连接的元数据生成查询: -AI 会自动识别你当前连接的数据库中的表名和字段名,不会生成不存在的表或字段。 +> 查看最近 30 天订单金额最高的 10 个客户 + +可能生成: + +```sql +SELECT c.name, SUM(o.amount) AS total_amount +FROM customers c +JOIN orders o ON c.id = o.customer_id +WHERE o.created_at >= NOW() - INTERVAL 30 DAY +GROUP BY c.id, c.name +ORDER BY total_amount DESC +LIMIT 10; +``` + +生成后建议检查: + +- 是否使用了正确的表和字段 +- 时间范围是否符合预期 +- 聚合和排序逻辑是否正确 +- 是否需要限制返回行数 ### 解释 SQL -选中一段复杂的 SQL 查询,AI 会逐步解释它的逻辑: +选中一段 SQL 后,可以让 AI 解释它的结构: - 每个子查询的作用 -- JOIN 条件的含义 -- WHERE 过滤条件的业务意义 -- 聚合函数和分组逻辑 +- `JOIN` 条件如何关联表 +- `WHERE` 条件过滤了什么 +- 聚合、分组和排序的意义 + +这适合阅读历史查询、接手报表 SQL 或理解复杂视图。 ### 优化 SQL -AI 会分析查询的潜在性能问题,给出优化建议: +AI 可以根据 SQL 和表结构给出优化方向,例如: -- 是否缺少索引 -- 是否可以减少全表扫描 -- 子查询是否可以改写为 JOIN -- 是否存在不必要的排序或去重 +- 是否可能发生全表扫描 +- 是否缺少合适索引 +- 子查询是否可以改写为 `JOIN` +- 排序、去重或聚合是否可以减少 + + +AI 的优化建议是参考信息。真正的性能判断仍应结合数据库的执行计划、数据量和索引情况。 + ### 修复错误 -查询执行失败时,点击 **AI 修复**,AI 会根据错误信息和 SQL 内容自动生成修正版本。常见场景包括: +当 SQL 执行失败时,可以把错误信息和当前 SQL 交给 AI 辅助分析。常见修复包括: -- 语法错误修正 -- 字段名或表名拼写错误 -- 缺少 GROUP BY 字段 +- 语法错误 +- 表名或字段名拼写错误 +- `GROUP BY` 字段缺失 - 类型不匹配 +- 不同数据库方言之间的语法差异 ## 支持的供应商 - - - | 模型 | 说明 | - |---|---| - | Claude 4 Opus | 最强模型,复杂查询推荐 | - | Claude 4 Sonnet | 速度与质量平衡 | - | Claude 3.5 Haiku | 最快响应 | - - 在 AI 设置中选择 **Anthropic**,填入 API Key 即可。 + + + 适合使用 Claude 系列模型。填写 API Key 后,在模型输入框中选择或填写你要使用的模型。 - | 模型 | 说明 | - |---|---| - | GPT-4o | 最新旗舰模型 | - | GPT-4o-mini | 轻量快速 | - | o3-mini | 推理增强 | - - 在 AI 设置中选择 **OpenAI**,填入 API Key 即可。 + 适合使用 OpenAI 模型。填写 API Key 后,在模型输入框中选择或填写你要使用的模型。 - 任何兼容 OpenAI Chat Completions API 的端点都可以使用,例如: + 适合兼容 OpenAI Chat Completions API 的服务,例如本地模型服务、企业网关或第三方模型平台。 - - **Ollama** — 本地运行开源模型 - - **LM Studio** — 本地模型管理 - - **Azure OpenAI** — 企业级部署 - - **DeepSeek / Qwen** — 国产大模型 + 需要配置: - 在 AI 设置中选择 **自定义端点**,填入端点 URL 和 API Key。 + - Endpoint URL + - API Key + - Model -## 更强大的 AI 体验 +## 隐私与安全 - -想让 AI 助手不只是生成 SQL,还能直接执行查询、浏览数据?试试 [MCP 集成](/cn/docs/mcp)。 - +AI 请求通常会包含你的问题、相关 SQL、错误信息,以及必要的表结构上下文。使用前请确认: -MCP 集成让 Claude Code、Cursor 等 AI 编程助手直接通过 DBX 查询你的数据库,并在 DBX 中打开结果。这意味着你可以在 IDE 中用自然语言和 AI 对话,AI 自动调用 DBX 执行查询并返回结果。 +- 当前供应商是否允许发送这些信息 +- 是否包含敏感字段名、业务规则或样例数据 +- 团队是否对第三方模型调用有合规要求 + +如果希望 AI 直接通过工具查询数据库,可以继续阅读 [MCP 集成](/cn/docs/mcp)。 diff --git a/docs/content/docs/ai-assistant.mdx b/docs/content/docs/ai-assistant.mdx index cd7dea6712..0bddf6d9d6 100644 --- a/docs/content/docs/ai-assistant.mdx +++ b/docs/content/docs/ai-assistant.mdx @@ -1,122 +1,130 @@ --- title: AI Assistant -description: Built-in AI assistant for natural language to SQL, query optimization, error fixing. Supports Claude, OpenAI, and custom endpoints. +description: Configure an AI provider to generate SQL, explain queries, suggest optimizations, and help fix errors in DBX. --- - -Built-in AI assistant — no plugins needed. Describe what you want in plain language, and AI generates SQL, optimizes queries, and fixes errors. +The AI assistant helps with SQL work. It uses metadata from the active connection to understand tables and columns, then helps generate SQL, explain queries, suggest optimizations, or diagnose errors. + + +AI-generated SQL is not executed automatically. Review table names, columns, filters, and affected rows before running it, especially on production connections. -DBX's AI assistant is deeply integrated with your database metadata. It knows your tables, columns, and relationships, so the SQL it generates actually works with your schema. - -![DBX AI Assistant](/screenshot-ai.jpg) - -## Setup +## Configuration ### Open Settings - Click the **Settings** icon in the toolbar. + + Open DBX settings and find the AI configuration section. - ### Choose AI Provider - Go to **AI Settings** and select your provider. + ### Choose a Provider + + Select Anthropic, OpenAI, or a custom endpoint compatible with the OpenAI API. - ### Enter API Key - Enter your API key (and endpoint URL for custom providers). + ### Enter Credentials + + Enter your API key. For custom endpoints, also enter the endpoint URL and model name. - ### Select a Model - Pick a model and you're ready to go. + ### Save and Test + + Save the configuration, return to the editor, and try generating a simple query from natural language. -## Core Features + +When no API key is configured, AI features should prompt the user to complete setup instead of failing silently. + -### Natural Language to SQL +## Common Uses -Describe what you want to query in plain language. The AI generates SQL based on your actual database schema: +### Generate SQL -> **You say:** "Show me the top 10 customers by total order amount in the last month" -> -> **AI generates:** -> ```sql -> SELECT c.name, SUM(o.amount) AS total_amount -> FROM customers c -> JOIN orders o ON c.id = o.customer_id -> WHERE o.created_at >= NOW() - INTERVAL 30 DAY -> GROUP BY c.id, c.name -> ORDER BY total_amount DESC -> LIMIT 10; -> ``` +Describe the result you want, and the assistant generates SQL using metadata from the current connection: -The AI auto-detects tables and columns in your connected database — it won't generate references to tables or columns that don't exist. +> Show the top 10 customers by order amount in the last 30 days + +Example output: + +```sql +SELECT c.name, SUM(o.amount) AS total_amount +FROM customers c +JOIN orders o ON c.id = o.customer_id +WHERE o.created_at >= NOW() - INTERVAL 30 DAY +GROUP BY c.id, c.name +ORDER BY total_amount DESC +LIMIT 10; +``` + +Before running generated SQL, check: + +- Whether the tables and columns are correct +- Whether the time range matches your intent +- Whether aggregation and ordering are correct +- Whether the result should be limited ### Explain SQL -Select a complex SQL query and ask the AI to explain it. It breaks down: +Select SQL and ask the assistant to explain its structure: - What each subquery does -- The purpose of JOIN conditions -- What the WHERE clause filters -- How aggregation and grouping work +- How `JOIN` conditions connect tables +- What the `WHERE` clause filters +- How aggregation, grouping, and sorting work + +This is useful for reading legacy queries, reports, or complex views. ### Optimize SQL -The AI analyzes your query for potential performance issues and suggests improvements: +The assistant can suggest optimization directions, such as: +- Possible full table scans - Missing indexes -- Full table scans that could be avoided -- Subqueries that could be rewritten as JOINs -- Unnecessary sorting or deduplication +- Subqueries that may be rewritten as `JOIN` +- Sorting, deduplication, or aggregation that could be reduced + + +AI optimization suggestions are advisory. Confirm performance with the database execution plan, data volume, and index design. + ### Fix Errors -When a query fails, click **Fix with AI**. The AI reads the error message and your SQL, then generates a corrected version. Common fixes include: +When SQL fails, send the error and query to the assistant for diagnosis. Common fixes include: -- Syntax error corrections +- Syntax errors - Misspelled table or column names -- Missing GROUP BY columns +- Missing `GROUP BY` columns - Type mismatches +- Dialect differences between database engines ## Supported Providers - - - | Model | Best For | - |---|---| - | Claude 4 Opus | Complex queries, highest quality | - | Claude 4 Sonnet | Balance of speed and quality | - | Claude 3.5 Haiku | Fastest responses | - - Select **Anthropic** in AI Settings and enter your API key. + + + Use this for Claude models. Enter your API key, then choose or type the model you want to use. - | Model | Best For | - |---|---| - | GPT-4o | Latest flagship model | - | GPT-4o-mini | Lightweight and fast | - | o3-mini | Enhanced reasoning | - - Select **OpenAI** in AI Settings and enter your API key. + Use this for OpenAI models. Enter your API key, then choose or type the model you want to use. - Any endpoint that implements the OpenAI Chat Completions API works, including: + Use this for services compatible with the OpenAI Chat Completions API, such as local model servers, enterprise gateways, or third-party model platforms. - - **Ollama** — Run open-source models locally - - **LM Studio** — Local model management - - **Azure OpenAI** — Enterprise deployment - - **DeepSeek / Qwen** — Additional model providers + Configure: - Select **Custom Endpoint** in AI Settings and enter the endpoint URL and API key. + - Endpoint URL + - API key + - Model -## Beyond Built-in AI +## Privacy and Security - -Want AI to not just generate SQL, but actually execute queries and browse results? Try the [MCP integration](/en/docs/mcp). - +AI requests may include your prompt, SQL, error messages, and the schema context needed to answer. Before using an external provider, confirm: -MCP integration lets AI coding agents like Claude Code and Cursor query your databases directly through DBX and open results in the DBX UI. You can have a natural language conversation with AI in your IDE, and it automatically calls DBX to run queries and return results. +- Whether sending this information is allowed +- Whether it includes sensitive field names, business logic, or sample data +- Whether your team has compliance rules for third-party model calls + +If you want AI agents to query databases through tools, continue with [MCP Integration](/en/docs/mcp). diff --git a/docs/content/docs/data-grid.cn.mdx b/docs/content/docs/data-grid.cn.mdx index 11fe1de47f..78349dca39 100644 --- a/docs/content/docs/data-grid.cn.mdx +++ b/docs/content/docs/data-grid.cn.mdx @@ -1,59 +1,75 @@ --- title: 数据表格 -description: 虚拟滚动浏览大数据量,行内编辑,SQL 预览,多格式导出。 +description: 在 DBX 中浏览、筛选、编辑、预览 SQL 并导出表数据。 --- +数据表格用于查看查询结果或表数据。它适合处理两类场景:快速浏览数据,以及在确认 SQL 后进行小范围数据修改。 + +## 浏览数据 + +DBX 使用虚拟滚动渲染表格,只渲染当前可视区域内的行。大表浏览时,滚动和选择操作不会因为一次性渲染所有行而明显变慢。 + +常用浏览操作: + +- 拖拽列边缘调整列宽 +- 双击列边缘根据内容自适应列宽 +- 点击列头排序 +- 使用行号定位数据 +- 打开单元格详情查看长文本、JSON 或其他复杂值 + +## 过滤与排序 + +| 功能 | 适合场景 | +|---|---| +| 搜索 | 在当前结果中快速定位包含关键字的行 | +| WHERE | 在数据库层面筛选数据,适合大表和精确条件 | +| ORDER BY | 在数据库层面排序,适合稳定复现查询结果 | + -虚拟滚动技术,10 万行数据依然流畅。行内编辑,保存前可预览将要执行的 SQL 语句。 +大表场景优先使用 `WHERE` 和 `ORDER BY`。它们在数据库层面执行,通常比客户端搜索更稳定。 -## 虚拟滚动 - -数据表格采用虚拟滚动技术,仅渲染当前可视区域内的行,即使表中有数十万条记录也能保持流畅的滚动和操作体验。 - ## 行内编辑 -直接在表格中编辑数据,无需编写 SQL 语句: +可以直接在表格里修改数据: -- **修改数据** — 双击单元格即可编辑,修改后的单元格会高亮标记 -- **新增行** — 点击工具栏中的"新增行"按钮,在表格底部插入一行空记录 -- **删除行** — 选中行后点击"删除"按钮,标记该行待删除 +- **修改单元格**:双击单元格进入编辑状态 +- **新增行**:在表格中添加一行待插入记录 +- **删除行**:选中行后标记为待删除 +- **设置 NULL**:在单元格详情面板中明确写入 `NULL` -所有修改会暂存在本地,不会立即写入数据库。 +所有修改都会先暂存在本地。保存前,DBX 会展示即将执行的 SQL。 ## SQL 预览 - -在点击"保存"之前,可以预览 DBX 即将执行的 `UPDATE`、`INSERT`、`DELETE` 语句,确认无误后再提交。 + +数据修改不会在编辑后立即写入数据库。点击保存前,请先检查 SQL 预览,尤其是在生产环境连接上。 -这样可以避免误操作对数据造成不可逆的影响。 +SQL 预览会展示 `UPDATE`、`INSERT` 或 `DELETE` 语句。这个步骤可以帮助你确认: -## 单元格详情面板 +- 更新条件是否正确 +- 新增行的字段是否完整 +- 删除操作是否命中预期行 +- `NULL`、空字符串和默认值是否符合预期 -点击单元格可在右侧打开详情面板,提供以下功能: +## 单元格详情 -- **值编辑器** — 在更大的编辑区域中编辑长文本、JSON 等复杂值 -- **设为 NULL** — 一键将单元格值设为 `NULL` +点击单元格可以打开详情面板。它适合处理表格内不方便直接编辑的值: -## 排序与过滤 +- 长文本 +- JSON +- SQL 片段 +- 多行内容 +- 需要显式设置为 `NULL` 的字段 -- **排序** — 点击列头可按该列升序或降序排列,鼠标悬浮在列头时会显示排序方向提示图标 -- **搜索** — 使用搜索框快速查找包含指定文本的行 -- **WHERE 过滤** — 输入自定义的 `WHERE` 条件,在数据库层面精确筛选,大表场景比客户端搜索更高效 -- **ORDER BY** — 独立的 `ORDER BY` 输入框,在数据库层面控制排序,与 WHERE 过滤互不干扰 +## 导出与复制 -## 列宽调整与行号 - -- 拖拽列头边缘可以调整列宽 -- **自适应列宽** — 双击列头边缘,自动根据表头和数据内容调整列宽 -- 表格左侧显示行号,方便定位 - -## 数据导出 - -| 格式 | 说明 | +| 格式 | 用途 | |---|---| -| CSV | 逗号分隔的文本文件,适合导入 Excel 或其他工具 | -| JSON | JSON 数组格式,适合程序处理 | -| Markdown | Markdown 表格格式,适合粘贴到文档中 | -| 复制为 INSERT | 右键选中的行,可复制为 `INSERT` 语句,方便粘贴到其他数据库执行 | +| CSV | 给 Excel、Numbers 或其他表格工具使用 | +| JSON | 给脚本、接口调试或程序处理使用 | +| Markdown | 粘贴到 Issue、PR、文档或聊天中 | +| INSERT | 将选中行复制为可执行的 `INSERT` 语句 | + +导出前建议先确认当前筛选和排序条件,避免导出范围和预期不一致。 diff --git a/docs/content/docs/data-grid.mdx b/docs/content/docs/data-grid.mdx index a93dbec951..5718f8da27 100644 --- a/docs/content/docs/data-grid.mdx +++ b/docs/content/docs/data-grid.mdx @@ -1,59 +1,75 @@ --- title: Data Grid -description: Virtual scrolling for 100K+ rows, inline editing with SQL preview, multi-format export. +description: Browse, filter, edit, preview SQL, and export table data in DBX. --- +The data grid displays query results and table data. It is designed for two common workflows: inspecting data quickly and making small, reviewable edits. + +## Browse Data + +DBX uses virtual scrolling, rendering only the rows visible on screen. Large tables remain responsive because the grid does not render every row at once. + +Common browsing actions: + +- Drag column borders to resize columns +- Double-click a column border to auto-fit width +- Click column headers to sort +- Use row numbers to locate records +- Open cell details for long text, JSON, or other complex values + +## Filter and Sort + +| Feature | Best For | +|---|---| +| Search | Finding rows in the current result set | +| WHERE | Database-level filtering for large tables or precise conditions | +| ORDER BY | Database-level ordering for reproducible results | + -Virtual scrolling keeps it smooth at 100K+ rows. Inline editing with full SQL preview before committing any changes. +For large tables, prefer `WHERE` and `ORDER BY`. They run in the database and are usually more reliable than client-side search. -## Virtual Scrolling - -The grid uses virtual scrolling — only the rows visible on screen are rendered at any given time, so performance remains consistent whether you are viewing 100 rows or 100,000 rows. - ## Inline Editing -Edit data directly in the grid without writing SQL: +You can edit data directly in the grid: -- **UPDATE** — Click a cell to modify its value. Changed cells are highlighted -- **INSERT** — Add a new row at the bottom and fill in cell values -- **DELETE** — Select rows and mark them for deletion +- **Update a cell**: double-click a cell and edit its value +- **Insert a row**: add a pending row in the grid +- **Delete rows**: select rows and mark them for deletion +- **Set NULL**: explicitly write `NULL` from the cell detail panel -All changes are staged locally and not written to the database until you confirm. +All changes are staged locally first. Before saving, DBX shows the SQL it is about to execute. ## SQL Preview - -Before saving, DBX shows a preview of the exact `UPDATE`, `INSERT`, or `DELETE` statements that will be executed. Review and confirm before committing. + +Edits are not written to the database immediately. Before saving, review the SQL preview carefully, especially on production connections. -This prevents accidental data modifications and gives you full visibility into what will change. +The preview shows `UPDATE`, `INSERT`, or `DELETE` statements. Use it to confirm: -## Cell Detail Panel +- Update conditions target the intended rows +- Inserted rows contain the expected fields +- Delete operations match the expected records +- `NULL`, empty strings, and default values are handled correctly -Click a cell to open its detail panel on the right side. The panel provides: +## Cell Details -- **Value Editor** — Edit long text, JSON, or other complex values in a larger, more comfortable editor -- **Set NULL** — Explicitly set a cell value to `NULL` with one click +Click a cell to open the detail panel. It is useful for values that are awkward to edit directly inside a table: -## Sorting and Filtering +- Long text +- JSON +- SQL fragments +- Multi-line content +- Fields that should be explicitly set to `NULL` -- **Sort** — Click a column header to sort ascending or descending. A sort hint icon appears when you hover over the column header -- **Search** — Use the search bar to find text across all visible columns -- **WHERE Filter** — Apply a custom `WHERE` clause for database-level filtering. More efficient than client-side search for large tables -- **ORDER BY** — Use the dedicated `ORDER BY` input to control the sort order at the database level, independent of the WHERE filter +## Export and Copy -## Column Resize and Row Numbers - -- Drag column borders to resize columns -- **Auto-fit** — Double-click a column border to automatically fit the column width based on header and data content -- Row numbers are displayed in the leftmost column - -## Export - -| Format | Description | +| Format | Use Case | |---|---| -| CSV | Comma-separated values, compatible with Excel and spreadsheet tools | -| JSON | Array of objects, suitable for use in code or APIs | -| Markdown | Markdown table, useful for pasting into documentation or chat | -| Copy as INSERT | Right-click selected rows to copy them as `INSERT` statements, ready to paste and execute in another database | +| CSV | Excel, Numbers, or spreadsheet tools | +| JSON | Scripts, API debugging, or programmatic processing | +| Markdown | Issues, PRs, documentation, or chat | +| INSERT | Copy selected rows as executable `INSERT` statements | + +Before exporting, check the active filters and sort order so the exported data matches what you expect. diff --git a/docs/content/docs/data-transfer.cn.mdx b/docs/content/docs/data-transfer.cn.mdx index 360a0f4626..d0a27df92c 100644 --- a/docs/content/docs/data-transfer.cn.mdx +++ b/docs/content/docs/data-transfer.cn.mdx @@ -1,47 +1,88 @@ --- title: 数据传输 -description: 跨引擎数据迁移,MySQL → PostgreSQL、SQLite → SQL Server,自动处理类型映射。 +description: 在不同连接或不同数据库引擎之间迁移表数据。 --- - -跨数据库引擎数据迁移,自动处理类型映射和语法差异。MySQL 到 PostgreSQL,SQLite 到 SQL Server,开箱即用。 +数据传输用于把表数据从一个连接复制到另一个连接。它适合开发、测试、迁移和数据整合场景,但不应该替代正式的数据同步链路。 + +## 适合的场景 + +- 把生产库的一部分数据复制到开发环境 +- 在 MySQL、PostgreSQL、SQLite、SQL Server 等引擎之间迁移数据 +- 将多个数据源整理到同一个分析库 +- 为测试环境准备一份可复现的数据集 + + +跨引擎传输会涉及类型映射、默认值、约束和自增字段差异。传输完成后请抽样检查数据,重要迁移建议先在测试环境演练。 -## 典型场景 - -- **跨引擎迁移** — MySQL → PostgreSQL、SQLite → SQL Server -- **环境数据同步** — 从生产库拉取数据到开发环境 -- **数据整合** — 将多个数据源的数据汇集到一个数据库 - ## 使用流程 - ### 选择源和目标 - 选择**源连接**和**目标连接**,可以是不同类型的数据库引擎。 + ### 选择源连接 + + 源连接是数据读取的位置。确认账号有读取目标表的权限。 - ### 选择要传输的表 - 选择传输全部表,或手动勾选需要传输的特定表。 + ### 选择目标连接 + + 目标连接是数据写入的位置。确认账号有写入权限,并确认目标库环境无误。 + + + ### 选择表 + + 可以传输全部表,也可以只选择需要的表。大表建议分批处理。 ### 开始传输 - 点击"开始传输",DBX 自动处理类型映射和语法差异。 + + DBX 会按表读取数据,并根据所选模式写入目标数据库。可选择是否创建目标表。 + + + ### 检查结果 + + 传输完成后检查行数、错误列表和关键字段。 -## 进度追踪 +## 传输过程 -传输过程中,DBX 实时显示: +DBX 会在传输过程中展示: -- 当前正在传输的表名 -- 已传输的行数 -- 整体传输进度 +- 当前正在处理的表 +- 已传输行数 +- 总体进度 +- 错误信息和对应表名 -## 错误处理 +如果某张表失败,当前传输会停止并展示错误信息。修正表结构、权限或约束问题后,可以重新发起传输。 -如果传输过程中遇到错误(如类型不兼容、约束冲突等),DBX 会: +## 传输选项 -- 记录错误信息和对应的表名 -- 继续传输其他表,不会因单个表的错误中断整个任务 -- 传输完成后汇总展示所有错误,便于排查和处理 +| 选项 | 说明 | +|---|---| +| 创建目标表 | 目标库没有对应表时,尝试根据源表结构创建 | +| 追加 | 将数据插入目标表现有数据之后 | +| 清空后导入 | 先清空目标表,再写入源数据 | +| 批大小 | 控制每批写入的行数 | + +## 传输前检查 + +| 检查项 | 原因 | +|---|---| +| 目标环境 | 避免误写生产库或错误环境 | +| 表结构 | 字段名、类型、主键和唯一约束会影响写入 | +| 数据量 | 大表可能需要更长时间,也可能触发超时 | +| 约束 | 外键、唯一约束、非空字段可能导致写入失败 | +| 敏感数据 | 从生产复制到低环境前,确认是否需要脱敏 | + +## 相关功能 + + + + 从 CSV、TSV、JSON 或 Excel 导入到单张表。 + + + 将数据库导出为 SQL 文件,便于备份或离线迁移。 + + diff --git a/docs/content/docs/data-transfer.mdx b/docs/content/docs/data-transfer.mdx index 736e12936c..57c584a693 100644 --- a/docs/content/docs/data-transfer.mdx +++ b/docs/content/docs/data-transfer.mdx @@ -1,47 +1,88 @@ --- title: Data Transfer -description: Cross-engine data migration with automatic type mapping. MySQL to PostgreSQL, SQLite to SQL Server. +description: Move table data between connections or database engines. --- - -Cross-engine data migration with automatic type mapping and syntax adaptation. MySQL to PostgreSQL, SQLite to SQL Server — it just works. - +Data Transfer copies table data from one connection to another. Use it for development, testing, migration, and consolidation workflows. It is not a replacement for a production-grade replication pipeline. ## Use Cases -- **Cross-engine migration** — MySQL → PostgreSQL, SQLite → SQL Server -- **Environment sync** — Pull production data into your dev environment -- **Data consolidation** — Merge data from multiple sources into one database +- Copy part of production data into a development environment +- Move data between engines such as MySQL, PostgreSQL, SQLite, and SQL Server +- Consolidate multiple sources into an analysis database +- Prepare reproducible datasets for testing + + +Cross-engine transfer involves type mapping, defaults, constraints, and auto-increment differences. Validate transferred data afterward, and rehearse important migrations in a test environment first. + ## Workflow - ### Select Source and Target - Choose the **source** and **target** connections. They can be different database engines. + ### Select the Source + + The source connection is where data is read from. Confirm the account can read the selected tables. + + + ### Select the Target + + The target connection is where data is written. Confirm write permissions and verify the target environment. ### Choose Tables - Transfer all tables at once, or pick a subset. + + Transfer all tables or select only the tables you need. For large tables, consider transferring in smaller batches. ### Start Transfer - Click "Start Transfer". DBX handles type mapping and syntax differences automatically. + + DBX reads rows table by table and writes them to the target database using the selected mode. You can also choose whether target tables should be created. + + + ### Check Results + + After transfer, inspect row counts, errors, and key fields. -## Progress Tracking +## During Transfer -During the transfer, a progress indicator shows: +DBX shows: -- Which table is currently being transferred -- How many rows have been transferred so far -- The overall progress across all selected tables +- Current table +- Rows transferred +- Overall progress +- Errors and the table that caused each error -## Error Handling +If a table fails, the current transfer stops and shows the error. Fix the structure, permission, or constraint issue, then start the transfer again. -If an error occurs during transfer (type incompatibility, constraint violation, etc.), DBX: +## Transfer Options -- Logs the error with details about which table caused the problem -- Continues transferring other tables without stopping the entire job -- Shows a summary of all errors after the transfer completes +| Option | Details | +|---|---| +| Create target table | Try to create the target table from the source structure when it does not exist | +| Append | Insert data after existing target rows | +| Truncate then import | Clear the target table before writing source rows | +| Batch size | Control how many rows are written per batch | + +## Before You Transfer + +| Check | Why It Matters | +|---|---| +| Target environment | Avoid writing to the wrong database | +| Table structure | Field names, types, primary keys, and unique constraints affect inserts | +| Data volume | Large tables may take longer or hit timeouts | +| Constraints | Foreign keys, unique constraints, and NOT NULL fields may fail writes | +| Sensitive data | Production data may need masking before copying into lower environments | + +## Related Features + + + + Import CSV, TSV, JSON, or Excel into a single table. + + + Export a database as SQL for backup or offline migration. + + diff --git a/docs/content/docs/database-export.cn.mdx b/docs/content/docs/database-export.cn.mdx index e230069bf6..0a774580fd 100644 --- a/docs/content/docs/database-export.cn.mdx +++ b/docs/content/docs/database-export.cn.mdx @@ -1,55 +1,72 @@ --- title: 数据库导出 -description: 将数据库导出为 SQL 文件,包含表结构和数据,支持行数限制。 +description: 将数据库结构和数据导出为 SQL 文件,用于备份、迁移或创建测试数据集。 --- - -一键导出完整数据库:表结构(DDL)+ 数据(INSERT),批量 INSERT 提高导入效率,可配置行数限制。 - +数据库导出会把表结构和表数据写入 SQL 文件。它适合在执行高风险操作前备份、迁移小型数据库,或为开发测试准备可复现的数据集。 ## 导出内容 -- **表结构(DDL)** — `CREATE TABLE` 语句,包括列定义、主键、索引、约束等 -- **表数据** — 以批量 `INSERT` 语句的形式导出 +| 内容 | 说明 | +|---|---| +| 表结构 | `CREATE TABLE`、字段、主键、索引、约束等 DDL | +| 表数据 | 以 `INSERT` 语句形式导出 | +| 批量插入 | 多行合并为一条 `INSERT`,减少文件体积和导入成本 | -## 批量 INSERT - -为了提高导入效率,DBX 将数据生成为批量 `INSERT` 语句: +示例: ```sql INSERT INTO users (id, name, email) VALUES -(1, '张三', 'zhangsan@example.com'), -(2, '李四', 'lisi@example.com'), -(3, '王五', 'wangwu@example.com'); + (1, '张三', 'zhangsan@example.com'), + (2, '李四', 'lisi@example.com'), + (3, '王五', 'wangwu@example.com'); ``` -## 行数限制 - -可以配置每张表导出的最大行数,适用于: - -- 只需要表结构和少量示例数据 -- 表中数据量过大,完整导出文件体积过大 -- 创建用于开发或测试的精简数据集 - -设置为 0 或留空表示导出全部数据。 - -## 使用方式 +## 使用流程 - ### 选择数据库 - 选择要导出的连接和数据库。 + ### 选择连接和数据库 + + 选择要导出的连接和数据库,确认当前环境无误。 - ### 配置选项 - 设置行数限制(可选)。 + ### 设置导出选项 + + 当前每张表最多导出 `10,000` 行。超过限制的表会在导出文件中标记为 truncated。 ### 选择保存位置 - 选择导出文件的保存路径。 + + 选择 `.sql` 文件保存路径。 ### 开始导出 - 导出的 `.sql` 文件可以通过 [SQL 文件执行](/cn/docs/sql-file) 功能重新导入。 + + DBX 会生成包含结构和数据的 SQL 文件。 + +## 行数限制 + +当前数据库导出使用固定的每表 `10,000` 行上限。这个限制适合这些场景: + +- 只需要表结构和少量样例数据 +- 表数据过大,不适合完整导出 +- 创建开发或测试用精简数据集 +- 分享可复现问题时,只导出必要样例 + +## 导入导出文件 + +导出的 `.sql` 文件可以通过 [SQL 文件执行](/cn/docs/sql-file) 导入到数据库中。 + + +导出文件可能包含敏感数据、账号信息、业务标识或用户隐私。分享前请确认是否需要脱敏。 + + +## 使用建议 + +- 高风险 Schema 操作前先导出备份 +- 迁移前先在测试库验证导入结果 +- 大型生产库或需要完整备份的场景更适合使用数据库原生备份工具 +- 导出的 SQL 文件建议妥善保存,避免提交到公开代码仓库 diff --git a/docs/content/docs/database-export.mdx b/docs/content/docs/database-export.mdx index 41120ef066..3cf2a40e7c 100644 --- a/docs/content/docs/database-export.mdx +++ b/docs/content/docs/database-export.mdx @@ -1,20 +1,19 @@ --- title: Database Export -description: Export database structure and data as SQL dump with batched INSERT and configurable row limits. +description: Export database structure and data as SQL for backup, migration, or test datasets. --- - -One-click database export: DDL + data as batched INSERT statements. Configurable row limits for dev/test datasets. - +Database Export writes table structure and table data into a SQL file. Use it before high-risk operations, for small database migrations, or to create reproducible development and test datasets. ## What Gets Exported -- **DDL** — `CREATE TABLE` statements with columns, types, defaults, constraints, and indexes -- **Data** — Row data as batched `INSERT` statements +| Content | Details | +|---|---| +| Structure | `CREATE TABLE`, columns, primary keys, indexes, constraints, and other DDL | +| Data | Rows exported as `INSERT` statements | +| Batched inserts | Multiple rows grouped into one `INSERT` to reduce file size and import overhead | -## Batched INSERT Statements - -Multiple rows are grouped into a single statement for smaller file size and faster imports: +Example: ```sql INSERT INTO users (id, name, email) VALUES @@ -23,33 +22,51 @@ INSERT INTO users (id, name, email) VALUES (3, 'Carol', 'carol@example.com'); ``` -## Configurable Row Limit - -Set a maximum number of rows to export per table. Useful for: - -- Exporting structure with sample data only -- Working with very large tables where full export is impractical -- Creating lightweight dev/test datasets - -Set to `0` or leave blank to export all rows. - -## Usage +## Workflow - ### Select Database - Choose the connection and database to export. + ### Select Connection and Database + + Choose the database to export and verify the environment. - ### Configure Options - Set the row limit (optional). + ### Configure Export Options + + DBX currently exports up to `10,000` rows per table. Tables that hit the limit are marked as truncated in the generated file. ### Choose Output Location - Select where to save the export file. + + Select where the `.sql` file should be saved. ### Start Export - The generated `.sql` file can be re-imported using the [SQL File Execution](/en/docs/sql-file) feature. + + DBX generates a SQL file containing structure and data. + +## Row Limits + +Database export currently uses a fixed `10,000` rows per table limit. This is useful when: + +- You only need schema plus sample data +- Full table data is too large to export +- You are creating a smaller dev or test dataset +- You need a minimal reproduction file for debugging + +## Importing the Export + +The generated `.sql` file can be imported with [SQL File Execution](/en/docs/sql-file). + + +Export files may contain sensitive data, account information, business identifiers, or user privacy data. Mask data before sharing when needed. + + +## Recommendations + +- Export a backup before high-risk schema operations +- Test imports in a non-production database before migration +- Use native database backup tools for large production databases or complete backups +- Keep exported SQL files out of public repositories diff --git a/docs/content/docs/field-lineage.cn.mdx b/docs/content/docs/field-lineage.cn.mdx index 1999033d31..9f805697e9 100644 --- a/docs/content/docs/field-lineage.cn.mdx +++ b/docs/content/docs/field-lineage.cn.mdx @@ -1,43 +1,51 @@ --- title: 字段血缘 -description: 追踪数据库中字段之间的关联关系,理解数据的来源和去向,数据治理必备功能。 +description: 追踪字段之间的来源、引用和潜在关联,辅助理解数据库结构。 --- +字段血缘用于回答一个常见问题:某个字段的数据从哪里来,又可能影响到哪里。它适合理解复杂库、排查影响范围和阅读历史结构。 + +## 能解决什么问题 + +- 修改字段前,查看哪些表、视图或查询可能依赖它 +- 接手陌生数据库时,快速理解字段之间的关系 +- 分析报表字段的来源和可能的上游数据 +- 发现没有显式外键但命名相似的潜在关系 + +## 关系来源 + +| 来源 | 可信度 | 说明 | +|---|---|---| +| 外键 | 高 | 数据库中已经声明的外键约束 | +| 视图 | 高 | 从视图定义中分析字段映射 | +| 查询历史 | 中 | 从执行过的 SQL 中分析 `JOIN`、`WHERE` 等引用关系 | +| 同名字段 | 低到中 | 根据字段名称相似性推断可能关系 | + -大多数数据库工具没有这个功能。DBX 从外键、视图、查询历史等多个维度自动分析字段关联,标注置信度,帮你理解数据的完整流向。 +字段血缘是辅助分析工具,不等同于数据治理平台里的强一致血缘。对关键结论,请结合数据库约束、视图定义和业务代码确认。 -## 为什么需要字段血缘? +## 查看方式 -- **数据治理** — 了解每个字段的数据来源,确保数据质量 -- **影响分析** — 修改表结构前,了解哪些下游视图或查询会受影响 -- **新人上手** — 快速理解复杂数据库中表与表之间的关系 +- 搜索表名或字段名 +- 按置信度筛选关系 +- 点击表或字段跳转到数据浏览或结构查看 +- 从某个字段出发查看上游或下游关联 -## 关联来源 +## 使用建议 -DBX 通过多种方式检测字段关联,每种方式标注不同的置信度: +- 优先相信外键和视图来源 +- 对查询历史和同名字段推断保持审查 +- 修改字段前,结合 Schema 对比和应用代码搜索一起判断影响范围 +- 对核心业务字段,建议补充数据库约束或文档注释 -### 外键关系(确定) +## 相关功能 -基于数据库中已定义的外键约束。例如 `orders.user_id → users.id`,这是最可靠的关联来源。 - -### 视图引用(高置信度) - -分析视图定义中的 SQL 语句,提取视图字段与底层表字段的映射关系。 - -### 查询历史引用 - -从你执行过的 SQL 查询中,分析 `JOIN` 条件和 `WHERE` 子句,推断字段之间可能存在的关联。 - -### 同名字段检测 - -检测不同表中名称相同的字段(如多个表中的 `user_id`),提示它们之间可能存在逻辑关联。 - -## 搜索与筛选 - -- **搜索** — 输入表名或字段名,过滤显示相关的血缘关系 -- **按置信度筛选** — 选择只查看特定置信度级别的关联(确定 / 高 / 全部) - -## 跳转导航 - -在血缘视图中,点击任意关联的表或字段,可以直接跳转到该表的数据浏览或结构查看页面,方便你快速了解上下游数据。 + + + 查看表、字段、外键和注释。 + + + 检查不同环境之间的结构差异。 + + diff --git a/docs/content/docs/field-lineage.mdx b/docs/content/docs/field-lineage.mdx index 90188ab10e..b959539c8a 100644 --- a/docs/content/docs/field-lineage.mdx +++ b/docs/content/docs/field-lineage.mdx @@ -1,43 +1,51 @@ --- title: Field Lineage -description: Trace column relationships across foreign keys, views, and query history. Essential for data governance. +description: Trace where columns come from, how they are referenced, and which relationships may exist. --- - -Most database tools don't have this. DBX automatically traces column relationships from foreign keys, views, and query history, with confidence levels — essential for understanding how data flows through your schema. - +Field Lineage helps answer a common question: where does a column's data come from, and what might depend on it? Use it to understand complex schemas, inspect impact, and read legacy structures. -## Why Field Lineage? +## What It Helps With -- **Data governance** — Understand where each column's data comes from and ensure data quality -- **Impact analysis** — Before changing a table structure, see which downstream views or queries are affected -- **Onboarding** — Quickly understand relationships across tables in a complex database +- Before changing a column, see which tables, views, or queries may depend on it +- Understand relationships in an unfamiliar database +- Trace where report fields may originate +- Discover possible relationships that are not declared as foreign keys ## Relationship Sources -DBX discovers column relationships from multiple sources, each with a different confidence level: +| Source | Confidence | Details | +|---|---|---| +| Foreign keys | High | Constraints declared in the database | +| Views | High | Field mappings analyzed from view definitions | +| Query history | Medium | Relationships inferred from executed SQL, including `JOIN` and `WHERE` usage | +| Same-name columns | Low to medium | Possible relationships inferred from similar column names | -### Foreign Key Relationships (Certain) + +Field Lineage is an analysis aid, not a strongly governed lineage platform. For critical decisions, confirm results with database constraints, view definitions, and application code. + -Relationships defined by foreign key constraints. For example, `orders.user_id → users.id`. These are authoritative and the most reliable source. +## Navigation -### View References (Likely) +- Search by table or column name +- Filter relationships by confidence +- Click a table or column to open data or structure views +- Start from one column and inspect upstream or downstream relationships -DBX analyzes view definitions to trace which columns in the view map back to columns in the underlying tables. +## Recommendations -### Query History References +- Treat foreign key and view relationships as the strongest signals +- Review query-history and same-name inferences carefully +- Before changing a column, combine lineage with schema diff and application code search +- For important business fields, add database constraints or documentation comments where possible -DBX analyzes your local query history to identify columns that are frequently joined or referenced together in `JOIN` and `WHERE` clauses. +## Related Features -### Same-Name Column Detection - -Columns that share the same name across different tables (e.g., `user_id` appearing in multiple tables) are flagged as potential relationships. - -## Searching and Filtering - -- **Search** — Filter relationships by table name or column name -- **Confidence filter** — Show only relationships at a specific confidence level (certain, likely, or all) - -## Click-Through Navigation - -Click any related table or column in the lineage view to navigate directly to it in the Data Grid or Schema Browser. + + + Inspect tables, columns, foreign keys, and comments. + + + Compare structure differences across environments. + + diff --git a/docs/content/docs/getting-started.cn.mdx b/docs/content/docs/getting-started.cn.mdx index 4b7f82b17b..da69d398b9 100644 --- a/docs/content/docs/getting-started.cn.mdx +++ b/docs/content/docs/getting-started.cn.mdx @@ -1,53 +1,76 @@ --- title: 快速开始 -description: 安装 DBX 并创建你的第一个数据库连接。 +description: 安装 DBX、创建第一个连接,并了解桌面版、Docker 版和源码运行方式。 --- -## 安装 +本页帮助你完成三件事: + +1. 安装 DBX 或启动 Docker 版本 +2. 创建第一个数据库连接 +3. 在需要参与开发时从源码运行项目 + +## 选择安装方式 - **Homebrew(推荐):** + 使用 Homebrew 安装: ```bash brew install --cask t8y2/tap/dbx ``` - 更新: + 更新到最新版本: + ```bash brew upgrade --cask t8y2/tap/dbx ``` - 也可以从 [Releases](https://github.com/t8y2/dbx/releases) 页面下载 `.dmg` 安装包。 + 也可以从 [GitHub Releases](https://github.com/t8y2/dbx/releases) 下载 `.dmg` 安装包。 - **Scoop(推荐):** + 使用 Scoop 安装: ```bash scoop bucket add dbx https://github.com/t8y2/scoop-bucket scoop install dbx ``` - 更新: + 更新到最新版本: + ```bash scoop update dbx ``` - 也可以从 [Releases](https://github.com/t8y2/dbx/releases) 页面下载 `.msi` 安装包。 + 也可以从 [GitHub Releases](https://github.com/t8y2/dbx/releases) 下载 `.msi` 安装包。 - 从 [Releases](https://github.com/t8y2/dbx/releases) 页面下载对应的安装包(`.deb` / `.AppImage`)。 - - - 通过 Docker 部署 DBX,适合团队共享和服务器环境: + 从 [GitHub Releases](https://github.com/t8y2/dbx/releases) 下载对应的安装包: + + | 格式 | 适用场景 | + |---|---| + | `.deb` | Debian、Ubuntu 及其衍生发行版 | + | `.AppImage` | 通用 Linux 桌面环境 | + + 如果使用 `.AppImage`,首次运行前可能需要添加执行权限: ```bash - docker run -d --name dbx -p 4224:4224 -v dbx-data:/app/data t8y2/dbx + chmod +x DBX*.AppImage + ``` + + + Docker 版本适合部署在服务器上,通过浏览器访问 DBX: + + ```bash + docker run -d \ + --name dbx \ + -p 4224:4224 \ + -v dbx-data:/app/data \ + t8y2/dbx ``` - 部署后通过浏览器访问 `http://localhost:4224` 即可使用。 + 启动后访问 `http://localhost:4224`。 - **Docker Compose:** + 使用 Docker Compose: ```yaml services: @@ -65,34 +88,70 @@ description: 安装 DBX 并创建你的第一个数据库连接。 + +桌面版更适合个人本机使用;Docker 版更适合服务器、自托管和浏览器访问。两者的核心功能保持一致,但部署和数据存储位置不同。 + + ## 创建第一个连接 - ### 新建连接 - 点击工具栏的 **新建连接** 按钮。 + ### 打开新建连接 + + 在侧边栏或工具栏中点击 **新建连接**。 ### 选择数据库类型 - 选择你要连接的数据库类型(MySQL、PostgreSQL、SQLite 等)。 + + 选择 MySQL、PostgreSQL、SQLite、Redis、MongoDB 等数据库类型。 ### 填写连接信息 - 填写主机、端口、用户名、密码。可选设置**默认数据库**,连接后自动切换到指定数据库。如需通过跳板机连接,可启用 [SSH 隧道](/cn/docs/ssh-tunnel)。 + + 填写主机、端口、用户名和密码。对于 PostgreSQL、MySQL 等数据库,可以设置默认数据库,连接后自动进入指定数据库。 - ### 测试并保存 - 点击 **测试** 验证连接是否正常,然后点击 **保存并连接**。 + ### 测试连接 + + 点击 **测试** 验证网络、账号和权限是否正常。如果数据库在内网或跳板机后面,可以启用 [SSH 隧道](/cn/docs/ssh-tunnel)。 + + + ### 保存并连接 + + 测试通过后点击 **保存并连接**。连接会出现在侧边栏中,之后可以直接打开。 -连接密码存储在系统钥匙串中(macOS Keychain / Windows 凭据管理器 / Linux Secret Service),不会明文保存在配置文件中。 +连接配置保存在本机应用数据目录的 SQLite 数据库中。密码、SSH 密码、SSH 密钥密码和连接字符串会从普通连接 JSON 中拆出,单独存放在 `connection_secrets` 表。 -## 开发环境搭建 +## 连接后可以做什么 -如果你想从源码运行 DBX,请参考以下步骤。 + + + 打开查询编辑器,使用补全、格式化、选中执行和查询历史。 + + + 打开表数据,使用过滤、排序、行内编辑和 SQL 预览。 + + + 从侧边栏浏览库、Schema、表、字段、索引和外键。 + + + +## 常见连接问题 + +| 现象 | 检查项 | +|---|---| +| 连接超时 | 主机地址、端口、防火墙、安全组、VPN 或内网访问权限 | +| 认证失败 | 用户名、密码、认证方式、账号是否允许远程登录 | +| 能连接但看不到表 | 默认数据库、Schema 权限、账号是否有读取元数据的权限 | +| 内网数据库无法访问 | 配置 SSH 隧道,或确认 Docker 部署所在机器能访问目标数据库 | + +## 从源码运行 + +如果你想参与开发或本地调试 DBX,可以从源码运行。 ### 环境要求 @@ -114,11 +173,11 @@ description: 安装 DBX 并创建你的第一个数据库连接。 ``` - 无需额外安装(ODBC 已内置于 Windows)。 + Windows 已内置 ODBC,通常不需要额外安装系统依赖。 -### 运行 +### 启动开发环境 ```bash git clone https://github.com/t8y2/dbx.git @@ -127,10 +186,10 @@ pnpm install pnpm dev:tauri ``` -### 构建 +### 构建桌面安装包 ```bash pnpm tauri build ``` -安装包输出在 `src-tauri/target/release/bundle/` 目录。 +构建产物会输出到 `src-tauri/target/release/bundle/`。 diff --git a/docs/content/docs/getting-started.mdx b/docs/content/docs/getting-started.mdx index b9a07fecc2..4b6cec1a08 100644 --- a/docs/content/docs/getting-started.mdx +++ b/docs/content/docs/getting-started.mdx @@ -1,53 +1,76 @@ --- title: Getting Started -description: Install DBX and create your first database connection. +description: Install DBX, create your first connection, and understand the desktop, Docker, and source-based workflows. --- -## Install +This guide gets you through three steps: + +1. Install DBX or start the Docker version +2. Create your first database connection +3. Run the project from source when you want to contribute or debug locally + +## Choose an Install Method - **Homebrew (recommended):** + Install with Homebrew: ```bash brew install --cask t8y2/tap/dbx ``` - Update: + Upgrade to the latest version: + ```bash brew upgrade --cask t8y2/tap/dbx ``` - You can also download the `.dmg` installer from the [Releases](https://github.com/t8y2/dbx/releases) page. + You can also download the `.dmg` installer from [GitHub Releases](https://github.com/t8y2/dbx/releases). - **Scoop (recommended):** + Install with Scoop: ```bash scoop bucket add dbx https://github.com/t8y2/scoop-bucket scoop install dbx ``` - Update: + Upgrade to the latest version: + ```bash scoop update dbx ``` - You can also download the `.msi` installer from the [Releases](https://github.com/t8y2/dbx/releases) page. + You can also download the `.msi` installer from [GitHub Releases](https://github.com/t8y2/dbx/releases). - Download the appropriate package (`.deb` / `.AppImage`) from the [Releases](https://github.com/t8y2/dbx/releases) page. - - - Run DBX as a self-hosted web application using Docker: + Download the right package from [GitHub Releases](https://github.com/t8y2/dbx/releases): + + | Format | Best For | + |---|---| + | `.deb` | Debian, Ubuntu, and related distributions | + | `.AppImage` | General Linux desktop environments | + + For `.AppImage`, you may need to make the file executable first: ```bash - docker run -d --name dbx -p 4224:4224 -v dbx-data:/app/data t8y2/dbx + chmod +x DBX*.AppImage + ``` + + + Use Docker when you want to host DBX on a server and access it from a browser: + + ```bash + docker run -d \ + --name dbx \ + -p 4224:4224 \ + -v dbx-data:/app/data \ + t8y2/dbx ``` - Then open `http://localhost:4224` in your browser. + Open `http://localhost:4224` after the container starts. - **Docker Compose:** + Docker Compose: ```yaml services: @@ -65,34 +88,70 @@ description: Install DBX and create your first database connection. + +Use the desktop app for personal local work. Use Docker for server-hosted or browser-based access. The core product is the same, but deployment and data storage differ. + + ## Create Your First Connection - ### New Connection - Click the **New Connection** button in the toolbar. + ### Open New Connection + + Click **New Connection** from the sidebar or toolbar. - ### Select Database Type - Choose the database engine you want to connect to (MySQL, PostgreSQL, SQLite, etc.). + ### Choose a Database Type + + Select MySQL, PostgreSQL, SQLite, Redis, MongoDB, or another supported engine. ### Enter Connection Details - Fill in host, port, username, and password. Optionally set a **default database** to connect to a specific database automatically. For databases behind a firewall, enable the [SSH Tunnel](/en/docs/ssh-tunnel). + + Fill in host, port, username, and password. For engines such as PostgreSQL and MySQL, you can set a default database so DBX opens it automatically after connecting. - ### Test and Save - Click **Test** to verify the connection, then click **Save & Connect**. + ### Test the Connection + + Click **Test** to verify network access, credentials, and permissions. If the database is behind a private network or bastion host, configure an [SSH Tunnel](/en/docs/ssh-tunnel). + + + ### Save and Connect + + When the test succeeds, click **Save & Connect**. The connection appears in the sidebar for future use. -Connection passwords are stored in your system keyring (macOS Keychain / Windows Credential Manager / Linux Secret Service), never as plain text in config files. +Connection configuration is stored in a local SQLite database under the app data directory. Passwords, SSH passwords, SSH key passphrases, and connection strings are removed from the normal connection JSON and stored separately in the `connection_secrets` table. -## Development Setup +## What to Try Next -To run DBX from source: + + + Open the query editor and use completion, formatting, selected execution, and query history. + + + Open table data and use filtering, sorting, inline editing, and SQL preview. + + + Browse databases, schemas, tables, columns, indexes, and foreign keys from the sidebar. + + + +## Common Connection Issues + +| Symptom | Check | +|---|---| +| Connection timeout | Host, port, firewall, security group, VPN, or private network access | +| Authentication failed | Username, password, auth method, and whether the account allows remote login | +| Connected but no tables are visible | Default database, schema permissions, and metadata read permissions | +| Private database is unreachable | Configure an SSH tunnel, or make sure the Docker host can reach the database | + +## Run From Source + +Use the source workflow when you want to contribute or debug DBX locally. ### Prerequisites @@ -114,11 +173,11 @@ To run DBX from source: ``` - No additional dependencies required (ODBC is built into Windows). + Windows includes ODBC support, so additional system dependencies are usually not required. -### Run +### Start the Development App ```bash git clone https://github.com/t8y2/dbx.git @@ -127,10 +186,10 @@ pnpm install pnpm dev:tauri ``` -### Build +### Build the Desktop App ```bash pnpm tauri build ``` -The installer will be in `src-tauri/target/release/bundle/`. +Build artifacts are written to `src-tauri/target/release/bundle/`. diff --git a/docs/content/docs/query-editor.cn.mdx b/docs/content/docs/query-editor.cn.mdx index 4b6ae451ad..f5bf22b70a 100644 --- a/docs/content/docs/query-editor.cn.mdx +++ b/docs/content/docs/query-editor.cn.mdx @@ -1,50 +1,81 @@ --- title: 查询编辑器 -description: 基于 CodeMirror 6 的 SQL 编辑器,语法高亮、智能补全、JOIN 建议和查询历史。 +description: 使用 DBX 的 SQL 编辑器编写、补全、格式化、执行和复用查询。 --- - -基于 CodeMirror 6 构建,深度感知数据库元数据,SQL 编写体验媲美 IDE。 - +查询编辑器用于完成日常 SQL 工作:编写查询、查看补全建议、格式化语句、执行选中片段,以及从历史记录中找回之前的 SQL。 -## 语法高亮 +## 基本工作流 -编辑器针对不同的 SQL 元素(关键字、表名、字符串、数字、注释等)提供语法着色,使 SQL 语句结构一目了然。高亮规则会根据当前连接的数据库类型自动适配。 + + + ### 打开连接 -## SQL 自动补全 + 从侧边栏选择一个数据库连接。DBX 会根据当前连接加载对应的数据库类型和元数据。 + + + ### 编写 SQL -在编辑器中输入时,DBX 会自动弹出补全建议: + 在编辑器中输入 SQL。补全会结合 SQL 关键字、表、视图、字段和部分关系信息给出建议。 + + + ### 执行查询 -- **关键字** — `SELECT`、`FROM`、`WHERE`、`GROUP BY` 等 SQL 关键字 -- **表名** — 当前数据库中的所有表和视图 -- **字段名** — 根据已输入的表名,自动补全对应的字段 -- **JOIN 补全** — 输入 `JOIN` 后,自动建议可关联的表及基于外键的关联条件 -- **APPLY 子句** — SQL Server 连接下,自动补全 `CROSS APPLY` 和 `OUTER APPLY` + 使用快捷键执行全部 SQL 或选中的 SQL 片段。结果会显示在编辑器下方的数据表格中。 + + + ### 复用历史 -补全列表会随着输入内容实时过滤,按 `Tab` 或 `Enter` 即可确认选择。 + 通过查询历史找回之前执行过的语句,适合重复排查和调试。 + + -## 执行查询 +## 执行 SQL + +| 操作 | macOS | Windows / Linux | +|---|---|---| +| 执行全部 SQL | `Cmd+Enter` | `Ctrl+Enter` | +| 执行选中 SQL | 选中文本后 `Cmd+Enter` | 选中文本后 `Ctrl+Enter` | -快捷键:`Cmd+Enter`(macOS)/ `Ctrl+Enter`(Windows/Linux)。选中文本时,仅执行选中部分。 +如果编辑器中有选中文本,DBX 只执行选中的 SQL;没有选中文本时,执行当前编辑器中的全部内容。 -| 操作 | 快捷键 | -|---|---| -| 执行全部 SQL | `Cmd+Enter` / `Ctrl+Enter` | -| 执行选中的 SQL | 先选中文本,再按 `Cmd+Enter` / `Ctrl+Enter` | +执行完成后,结果区域会展示返回行、耗时、影响行数或错误信息。多语句执行时,建议先选中要执行的片段,减少误操作。 -执行结果会显示在编辑器下方的数据表格中,包括返回的数据行、执行耗时和影响行数。 +## 自动补全 -## SQL 格式化 +补全建议来自当前连接的数据库上下文: -点击工具栏中的格式化按钮,可以将当前 SQL 语句自动格式化为统一的缩进和换行风格,便于阅读和维护。 +- **SQL 关键字**:例如 `SELECT`、`FROM`、`WHERE`、`GROUP BY` +- **对象名称**:表、视图、Schema、数据库 +- **字段名称**:根据已经输入的表名或别名推断字段 +- **JOIN 建议**:基于外键或已知关系提示可关联表和关联条件 +- **SQL Server 语法**:SQL Server 连接下支持 `CROSS APPLY`、`OUTER APPLY` 等补全 + + +补全的准确性依赖当前连接的元数据。如果刚创建表或修改字段,可以刷新连接元数据后再试。 + + +## 格式化 SQL + +点击工具栏中的格式化按钮,可以统一缩进、换行和关键字风格。格式化适合在提交迁移脚本、分享查询或排查复杂 SQL 前使用。 + +格式化只改变 SQL 文本,不会执行 SQL,也不会改变数据库内容。 ## 查询历史 -DBX 会自动记录你执行过的 SQL 语句: +DBX 会记录已经执行过的 SQL,方便复用: -- 在查询历史面板中浏览之前执行过的所有 SQL -- 点击某条历史记录,将其填入编辑器重新执行 -- 按时间顺序查看历史记录 -- 每个连接独立记录,切换连接后只显示该连接的历史 +- 每个连接独立保存查询历史 +- 可以按时间查看之前执行的语句 +- 点击历史记录可重新填入编辑器 +- 适合找回临时排查 SQL、报表查询和修复语句 + + +查询历史可能包含业务字段、表名或筛选条件。共享电脑或演示环境中,建议注意历史记录里的敏感信息。 + + +## 与数据表格配合 + +查询结果会进入 [数据表格](/cn/docs/data-grid)。如果查询结果可编辑,DBX 会在保存前展示将要执行的 SQL;如果只是临时分析,可以直接导出 CSV、JSON 或 Markdown。 diff --git a/docs/content/docs/query-editor.mdx b/docs/content/docs/query-editor.mdx index a0c9e12ffb..140da0b107 100644 --- a/docs/content/docs/query-editor.mdx +++ b/docs/content/docs/query-editor.mdx @@ -1,50 +1,81 @@ --- title: Query Editor -description: CodeMirror 6-powered SQL editor with syntax highlighting, smart autocomplete, JOIN suggestions, and query history. +description: Write, complete, format, execute, and reuse SQL in DBX. --- +The query editor is where daily SQL work happens: writing queries, using completion, formatting statements, executing selected fragments, and returning to previous SQL through history. + +## Basic Workflow + + + + ### Open a Connection + + Select a database connection from the sidebar. DBX loads the database type and metadata for the active connection. + + + ### Write SQL + + Type SQL in the editor. Completion suggestions use SQL keywords, tables, views, columns, and available relationship metadata. + + + ### Execute the Query + + Use the shortcut to execute all SQL or only the selected fragment. Results appear in the data grid below the editor. + + + ### Reuse History + + Open query history to bring back previously executed SQL for repeated debugging or analysis. + + + +## Execute SQL + +| Action | macOS | Windows / Linux | +|---|---|---| +| Execute all SQL | `Cmd+Enter` | `Ctrl+Enter` | +| Execute selected SQL | Select text, then `Cmd+Enter` | Select text, then `Ctrl+Enter` | + -Built on CodeMirror 6 with deep database metadata awareness. A SQL editing experience that rivals a full IDE. +When text is selected, DBX executes only the selected SQL. When nothing is selected, it executes the full editor content. -## Syntax Highlighting - -The editor applies language-aware syntax highlighting for SQL. Keywords, identifiers, strings, numbers, and comments are visually distinguished, making queries easier to read and write. Highlighting rules adapt automatically based on the connected database type. +After execution, the result area shows returned rows, duration, affected row count, or the error message. For multi-statement scripts, select the exact fragment you want to run to reduce mistakes. ## Autocomplete -As you type, the editor suggests completions drawn from your actual database metadata: +Completion suggestions come from the active database context: -- **Keywords** — standard SQL keywords (`SELECT`, `FROM`, `WHERE`, etc.) -- **Table names** — all tables and views visible in the current connection -- **Column names** — columns scoped to the tables referenced in your query -- **JOIN suggestions** — when typing a `JOIN` clause, the editor suggests related tables and join conditions based on foreign key relationships -- **APPLY clauses** — for SQL Server, the editor suggests `CROSS APPLY` and `OUTER APPLY` completions - -Completions appear automatically and can also be triggered manually with the platform shortcut. - -## Executing Queries +- **SQL keywords**: `SELECT`, `FROM`, `WHERE`, `GROUP BY`, and more +- **Object names**: tables, views, schemas, and databases +- **Column names**: inferred from referenced tables and aliases +- **JOIN suggestions**: related tables and join conditions from foreign keys or known relationships +- **SQL Server syntax**: `CROSS APPLY`, `OUTER APPLY`, and related completions for SQL Server connections -Shortcut: `Cmd+Enter` (macOS) / `Ctrl+Enter` (Windows/Linux). When text is selected, only the selection is executed. +Completion accuracy depends on connection metadata. If you just created a table or changed columns, refresh the connection metadata and try again. -| Action | Shortcut | -|---|---| -| Execute all SQL | `Cmd+Enter` / `Ctrl+Enter` | -| Execute selected SQL | Select text, then `Cmd+Enter` / `Ctrl+Enter` | +## Format SQL -Results appear immediately below the editor in the Data Grid, showing returned rows, execution time, and affected row count. +Use the format button in the toolbar to standardize indentation, line breaks, and keyword style. Formatting is useful before sharing a query, reviewing a migration script, or debugging a complex statement. -## SQL Formatting - -Use the format button in the toolbar to auto-format your SQL. The formatter standardizes indentation, keyword casing, and line breaks so that complex queries are easier to read and review. +Formatting only changes the editor text. It does not execute SQL or modify the database. ## Query History -Every executed query is recorded in your local query history: +DBX records executed SQL so you can reuse it later: -- Browse previously executed queries in the history panel -- Click any past query to load it back into the editor -- Search through past queries by keyword -- History is stored per connection — switching connections shows only the relevant history +- History is stored per connection +- Previous statements can be reviewed by time +- Clicking a history item loads it back into the editor +- Useful for investigation queries, reports, and repair statements + + +Query history may include business fields, table names, or filter values. Be mindful of sensitive information on shared machines or demo environments. + + +## Working With the Data Grid + +Query results open in the [Data Grid](/en/docs/data-grid). If the result is editable, DBX shows the SQL before saving changes. For analysis-only results, you can export CSV, JSON, or Markdown. diff --git a/docs/content/docs/schema-browser.cn.mdx b/docs/content/docs/schema-browser.cn.mdx index 7bf3127d17..eed077e08f 100644 --- a/docs/content/docs/schema-browser.cn.mdx +++ b/docs/content/docs/schema-browser.cn.mdx @@ -1,17 +1,15 @@ --- title: 结构浏览 -description: 树形结构浏览器,搜索、置顶、右键菜单、字段注释、连接颜色标记。 +description: 使用侧边栏浏览连接、数据库、Schema、表、字段和 Redis 键空间。 --- - -树形层级浏览数据库中的所有对象,支持搜索、置顶、字段注释显示和连接颜色标记,多连接多环境轻松区分。 - +结构浏览器是 DBX 的左侧工作区,用于理解当前连接里有哪些数据库对象,并快速打开表数据、表结构或上下文操作。 -## 树形视图 +## 层级结构 -侧边栏以树形层级展示数据库结构: +侧边栏按数据库对象层级组织: -``` +```text 连接 └── 数据库 └── Schema @@ -19,40 +17,70 @@ description: 树形结构浏览器,搜索、置顶、右键菜单、字段注 └── 字段(类型、约束、默认值) ``` -点击节点展开或折叠,点击表名直接打开数据浏览视图。字段节点会显示数据类型等属性。 +点击节点可以展开或折叠;点击表名可以打开数据浏览;字段节点会展示类型、约束和默认值等信息。 -## 搜索与置顶 +## 搜索 -- **搜索** — 在侧边栏顶部输入关键词,可跨连接过滤匹配的表、视图或字段 -- **置顶** — 将常用的表或连接置顶显示,不管层级多深都能快速访问 +侧边栏搜索用于在对象数量较多时快速定位: -## 右键上下文菜单 - -右键点击节点,根据类型提供不同操作: - -- **连接** — 刷新元数据、复制连接、断开连接 -- **数据库** — 创建数据库、删除数据库 -- **Schema** — 创建 Schema、删除 Schema -- **表** — 打开数据、查看结构、复制表名、删除表 -- **字段** — 复制字段名 - -## 字段注释显示 - -如果数据库中的字段设置了注释(`COMMENT`),树形视图会在字段名旁边显示注释文本,帮助理解字段含义。 - -## 连接颜色标记 +- 表名 +- 视图名 +- 字段名 +- 部分数据库对象路径 -为每个连接设置颜色标记,开发环境用绿色、生产环境用红色,一眼区分,避免误操作。 +当连接中有大量表时,搜索会优先面向可见对象和缓存的元数据工作。刚刷新或首次展开的对象,可能需要等待元数据加载完成后才能完整匹配。 -颜色显示在侧边栏的连接名称旁和标签页中,多连接场景下尤其实用。 +## 置顶 + +把常用连接、数据库或表置顶后,可以减少在深层树结构中反复展开的操作。置顶适合这些对象: + +- 高频查询表 +- 当前迭代相关表 +- 生产环境中需要重点区分的连接 +- 排查问题时反复查看的对象 + +## 右键菜单 + +不同节点会显示不同的上下文操作: + +| 节点 | 常用操作 | +|---|---| +| 连接 | 刷新元数据、复制连接、断开连接、编辑连接 | +| 数据库 | 创建数据库、删除数据库、导出数据库 | +| Schema | 创建 Schema、删除 Schema | +| 表 | 打开数据、查看结构、导入数据、复制表名、删除表 | +| 字段 | 复制字段名、查看字段信息 | + + +删除数据库、删除 Schema、删除表等操作可能不可恢复。执行前请确认当前连接环境,必要时先备份。 + + +## 字段注释 + +如果数据库支持字段注释,DBX 会在字段旁展示注释内容。对于接手陌生库或阅读历史表结构,这通常比只看字段名更有帮助。 + +## 连接颜色 + +可以给连接设置颜色,用于区分环境。例如: + +| 环境 | 建议颜色 | +|---|---| +| 本地 | 灰色或绿色 | +| 测试 | 蓝色或紫色 | +| 预发 | 黄色 | +| 生产 | 红色 | + +颜色会出现在侧边栏连接名称和标签页中,帮助减少误操作。 ## Redis 浏览器 -Redis 浏览器为 Redis 数据管理提供了专门的交互界面: +Redis 连接会使用更适合键值数据的浏览方式: -- **表格视图** — 键值以 Navicat 风格的表格形式展示,便于浏览和管理 -- **行内编辑** — 直接在浏览器中编辑键值,无需切换到独立编辑器 -- **分页浏览** — 内置分页功能,浏览大量键时不会因一次性加载所有键而卡顿 -- **全类型支持** — 完整支持 String、Hash、List、Set、Sorted Set (ZSet) 和 Stream +- 键以表格方式展示,便于扫描 +- 支持分页浏览,避免一次性加载大量键 +- 可直接查看和编辑键值 +- 支持 String、Hash、List、Set、Sorted Set 和 Stream + +Redis 键空间较大时,建议配合搜索和分页使用,避免一次性展开过多数据。 diff --git a/docs/content/docs/schema-browser.mdx b/docs/content/docs/schema-browser.mdx index 7588c66032..7bc5eef996 100644 --- a/docs/content/docs/schema-browser.mdx +++ b/docs/content/docs/schema-browser.mdx @@ -1,17 +1,15 @@ --- title: Schema Browser -description: Tree view with search, pin, context menus, column comments, and connection colors. +description: Browse connections, databases, schemas, tables, columns, and Redis keyspaces from the sidebar. --- - -Explore your database objects in a hierarchical tree with search, pin, column comments, and color-coded connections to tell dev from production at a glance. - +The schema browser is the left-side workspace in DBX. Use it to understand what exists in a connection and to open data, inspect structure, or run context-specific actions. -## Tree View +## Object Hierarchy -The browser organizes objects in a hierarchical tree: +The sidebar organizes objects by database hierarchy: -``` +```text Connection └── Database └── Schema @@ -19,40 +17,70 @@ Connection └── Columns (type, constraints, defaults) ``` -Expand any node to drill down. Click a table name to open it in the Data Grid. Column entries display their data type and attributes inline. +Expand or collapse nodes to drill down. Click a table to open its data. Column entries show type, constraints, defaults, and related attributes when available. -## Search and Pin +## Search -- **Search** — Type in the search field to filter across all connections, matching table names, view names, and column names -- **Pin** — Pin frequently used tables or views to the top of the sidebar for instant access, regardless of tree depth +Sidebar search helps locate objects when a connection contains many tables: + +- Table names +- View names +- Column names +- Parts of database object paths + + +For large schemas, search works best with visible objects and cached metadata. Objects that were just refreshed or not yet expanded may need metadata loading before they are fully matched. + + +## Pinning + +Pin frequently used connections, databases, or tables to reduce repeated navigation through deep trees. Pinning is useful for: + +- High-frequency query tables +- Objects related to the current iteration +- Production connections that should stand out +- Tables repeatedly checked during debugging ## Context Menus -Right-click any node for context-specific actions: +Different node types expose different actions: -- **Connection** — Refresh metadata, duplicate connection, disconnect -- **Database** — Create database, drop database -- **Schema** — Create schema, drop schema -- **Table** — Open data, open structure, copy table name, drop table -- **Column** — Copy column name +| Node | Common Actions | +|---|---| +| Connection | Refresh metadata, duplicate connection, disconnect, edit connection | +| Database | Create database, drop database, export database | +| Schema | Create schema, drop schema | +| Table | Open data, open structure, import data, copy table name, drop table | +| Column | Copy column name, inspect column details | + + +Dropping databases, schemas, or tables may be irreversible. Confirm the active connection and back up data when needed. + ## Column Comments -If your database supports column comments (`COMMENT`), the Schema Browser displays them alongside each column, making it easy to understand column purposes without leaving the sidebar. +When the database supports column comments, DBX displays them next to columns. This is especially helpful when you are reading an unfamiliar schema or legacy database. ## Connection Colors - -Assign colors to connections — green for dev, red for production — to tell them apart at a glance and avoid accidental operations on the wrong environment. - +Connection colors help separate environments: -Colors appear next to connection names in the sidebar and in tabs, especially useful when working with multiple connections. +| Environment | Suggested Color | +|---|---| +| Local | Gray or green | +| Test | Blue or purple | +| Staging | Yellow | +| Production | Red | + +Colors appear beside connection names in the sidebar and in tabs, reducing the chance of operating on the wrong environment. ## Redis Browser -The Redis browser provides a dedicated interface for browsing and managing Redis data: +Redis connections use a browser designed for key-value data: -- **Table View** — Keys are displayed in a Navicat-style table layout for easier scanning and management -- **Inline Editing** — Edit key values directly in the browser without switching to a separate editor -- **Pagination** — Browse large keyspaces with built-in pagination, avoiding performance issues from loading all keys at once -- **All Data Types** — Full support for String, Hash, List, Set, Sorted Set (ZSet), and Stream +- Keys are displayed in a table for easier scanning +- Pagination avoids loading large keyspaces at once +- Values can be viewed and edited directly +- String, Hash, List, Set, Sorted Set, and Stream are supported + +For large Redis keyspaces, use search and pagination together instead of expanding too much data at once. diff --git a/docs/content/docs/schema-diff.cn.mdx b/docs/content/docs/schema-diff.cn.mdx index 86917b87f5..c77e6a1add 100644 --- a/docs/content/docs/schema-diff.cn.mdx +++ b/docs/content/docs/schema-diff.cn.mdx @@ -1,42 +1,81 @@ --- title: Schema 对比 -description: 比较两个数据库的结构差异,自动生成同步 SQL,开发与生产环境一键对齐。 +description: 对比两个数据库的结构差异,生成可审查的同步 SQL。 --- - -跨数据库结构对比,自动生成同步 SQL。无论是开发 vs 生产、还是不同环境之间的数据库结构对齐,一键搞定。 +Schema 对比用于检查两个数据库环境之间的结构差异,例如开发库和生产库、测试库和预发库,或迁移前后的数据库。 + + +Schema 同步可能包含删除表、删除字段、修改字段类型等破坏性操作。生成 SQL 后请逐条审查,生产环境建议先备份。 -## 典型场景 +## 适合的场景 -- **开发 vs 生产** — 检查开发环境的 Schema 变更是否已同步到生产 -- **多环境对齐** — 确保 staging、QA、production 的表结构一致 -- **版本迁移** — 对比新旧版本数据库结构,生成迁移脚本 +- 检查开发环境中的结构变更是否已经同步到生产 +- 对齐 staging、QA、production 等多套环境 +- 生成迁移脚本,交给团队审查后执行 +- 对比两个版本数据库之间的表、字段、索引差异 ## 使用流程 - ### 选择源和目标 - 分别选择**源数据库**和**目标数据库**连接。可以是不同的服务器,甚至不同的数据库引擎。 + ### 选择源库 + + 源库通常是你认为“结构较新”或“结构正确”的数据库。 + + + ### 选择目标库 + + 目标库是需要被检查或同步的数据库。它可以和源库位于不同服务器,也可以是不同数据库引擎。 ### 执行对比 - 点击"对比"按钮,DBX 自动分析两个数据库中所有表和字段的差异。 + + DBX 会读取两边的表、字段和索引元数据,并计算差异。当前对比只处理表,不包含视图。 ### 审查差异 - 对比结果以清晰的列表展示: - - **仅在源库存在的表** — 目标库中缺少的表 - - **仅在目标库存在的表** — 源库中没有的表 - - **结构不同的表** — 字段类型、默认值、索引等存在差异的表 + + 重点检查缺失表、额外表、字段类型变化、是否允许 NULL、默认值变化、索引增删和可能的数据风险。 - ### 生成并执行同步 SQL - DBX 根据差异自动生成 `CREATE TABLE`、`ALTER TABLE`、`DROP TABLE` 等 SQL 语句。确认无误后,可以直接在 DBX 中执行。 + ### 生成同步 SQL + + 根据差异生成 `CREATE TABLE`、`ALTER TABLE`、`DROP TABLE` 等语句。确认后再决定是否执行。 - -Schema 同步可能包含破坏性操作(如删除表或列)。执行前请仔细审查生成的 SQL,建议先备份目标数据库。 +## 差异类型 + +| 类型 | 含义 | +|---|---| +| 仅源库存在 | 目标库缺少该对象,通常需要创建 | +| 仅目标库存在 | 目标库多出该对象,删除前需要确认是否仍被使用 | +| 字段差异 | 字段类型、是否允许 NULL 或默认值不同 | +| 索引差异 | 按索引名称检查新增或删除的索引 | + + +当前 Schema 对比不完整覆盖外键、触发器、视图定义、字段注释,也不会检测同名索引的列或唯一性变化。重要迁移仍建议人工审查生成的 SQL。 + +## 执行前检查 + +同步前建议确认: + +- 当前连接颜色和环境名称是否正确 +- 目标库是否已经备份 +- `DROP`、`TRUNCATE`、字段类型变更是否符合预期 +- 是否需要在业务低峰期执行 +- 是否需要先在测试环境验证生成的 SQL + +## 相关功能 + + + + 对单张表进行可视化结构修改,并在保存前预览 DDL。 + + + 在执行高风险同步前导出结构和数据。 + + diff --git a/docs/content/docs/schema-diff.mdx b/docs/content/docs/schema-diff.mdx index 03debc2a36..15a99ce308 100644 --- a/docs/content/docs/schema-diff.mdx +++ b/docs/content/docs/schema-diff.mdx @@ -1,42 +1,81 @@ --- title: Schema Diff -description: Compare database schemas, generate sync SQL, and align dev with production in one click. +description: Compare two database schemas and generate reviewable sync SQL. --- - -Compare schemas across databases and generate sync SQL. Align dev, staging, and production environments in one click. +Schema Diff helps compare structure between database environments, such as development and production, staging and QA, or databases before and after a migration. + + +Schema sync may include destructive operations such as dropping tables, dropping columns, or changing column types. Review generated SQL line by line, and back up production databases first. ## Use Cases -- **Dev vs Production** — Check whether schema changes in development have been applied to production -- **Multi-environment alignment** — Ensure staging, QA, and production share the same table structure -- **Version migration** — Compare old and new database versions and generate migration scripts +- Check whether schema changes from development are already applied to production +- Align staging, QA, and production environments +- Generate migration SQL for team review +- Compare tables, columns, indexes, and constraints between database versions ## Workflow - ### Select Source and Target - Choose the **source** and **target** database connections. They can be on different servers or even different database engines. + ### Select the Source + + The source is usually the database whose structure is newer or considered correct. - ### Run Comparison - Click "Compare" and DBX analyzes all tables and columns across both databases. + ### Select the Target + + The target is the database to inspect or sync. It can be on another server or even another database engine. + + + ### Run the Comparison + + DBX reads table, column, and index metadata from both sides. The current comparison handles tables, not views. ### Review Differences - Results are presented in a clear list: - - Tables that exist only in the source - - Tables that exist only in the target - - Tables with structural differences (column types, defaults, indexes) + + Check missing tables, extra tables, column type changes, nullable changes, default value changes, added or removed indexes, and data risk. - ### Generate and Execute Sync SQL - DBX generates `CREATE TABLE`, `ALTER TABLE`, and `DROP TABLE` statements based on the differences. Review and execute them directly in DBX. + ### Generate Sync SQL + + DBX generates statements such as `CREATE TABLE`, `ALTER TABLE`, and `DROP TABLE`. Review them before execution. - -Schema sync may include destructive operations (such as dropping tables or columns). Always review the generated SQL carefully and consider backing up the target database first. +## Difference Types + +| Type | Meaning | +|---|---| +| Source only | The object is missing from the target and may need to be created | +| Target only | The object exists only in the target; confirm usage before dropping it | +| Column difference | Type, nullable flag, or default value differs | +| Index difference | Added or removed indexes, matched by index name | + + +Schema Diff currently does not fully compare foreign keys, triggers, view definitions, column comments, or changed columns/uniqueness inside an index with the same name. Important migrations still need manual SQL review. + +## Before Running Sync SQL + +Before applying generated SQL, confirm: + +- The active connection color and environment name are correct +- The target database has been backed up +- `DROP`, `TRUNCATE`, and column type changes are intentional +- The operation should run during a maintenance window +- The SQL has been tested in a non-production environment + +## Related Features + + + + Edit one table visually and preview DDL before applying changes. + + + Export structure and data before high-risk sync operations. + + diff --git a/docs/content/docs/sql-file.cn.mdx b/docs/content/docs/sql-file.cn.mdx index cae1549a23..22782194c7 100644 --- a/docs/content/docs/sql-file.cn.mdx +++ b/docs/content/docs/sql-file.cn.mdx @@ -1,41 +1,70 @@ --- title: SQL 文件执行 -description: 直接执行 .sql 文件,智能语句分割,进度追踪,支持取消。 +description: 选择连接后执行 .sql 文件,查看进度,并在需要时取消后续语句。 --- - -直接执行 `.sql` 文件,智能分割语句(正确处理函数、触发器、字符串中的分号),实时显示进度。 +SQL 文件执行用于导入或运行本地 `.sql` 脚本。它适合执行初始化脚本、数据补丁、数据库导出文件和迁移脚本。 + + +执行 SQL 文件可能修改大量数据或结构。运行前请确认目标连接、目标数据库和脚本来源,生产环境建议先备份。 -## 执行 SQL 文件 +## 使用流程 - ### 打开功能 - 打开 SQL 文件执行面板。 + ### 打开 SQL 文件执行 + + 在 DBX 中打开 SQL 文件执行面板。 ### 选择文件 - 选择要执行的 `.sql` 文件。 + + 选择本地 `.sql` 文件。大文件可能需要更长解析和执行时间。 - ### 选择目标 - 选择目标数据库连接。 + ### 选择目标连接 + + 选择要执行脚本的数据库连接和数据库。 - ### 执行 - 点击"执行",实时查看进度。 + ### 开始执行 + + 点击执行后,DBX 会按语句执行并显示进度。 + + + ### 检查结果 + + 执行结束后查看成功数量、失败语句和错误信息。 -## 智能语句分割 +## 语句分割 -DBX 使用智能分割逻辑来正确解析每条语句的边界: +DBX 会按流式方式读取 SQL 文件,并尽量正确识别语句边界,避免简单按每个分号拆分: -- **函数和存储过程** — `BEGIN...END` 块不会被错误地按分号拆分 -- **触发器定义** — 自定义分隔符的触发器语句能被正确识别 -- **引号内的字符串** — 字符串中的分号不会被当作语句分隔符 +- 字符串中的分号不会被当作语句结束 +- 行注释和块注释中的分号不会被当作语句结束 +- PostgreSQL 的 dollar-quoted 函数体会保持为同一条语句 +- MySQL executable comments 会作为可执行语句处理 + +## 错误处理 + +默认情况下,执行遇到错误会停止。你也可以启用“遇错继续”,让 DBX 继续执行后续语句并记录失败数量。 ## 取消执行 -SQL 文件较大时,可以随时点击"取消"按钮中断执行。已执行的语句不会被回滚,仅停止后续语句的执行。 +执行过程中可以取消任务。取消只会阻止后续语句继续执行,已经提交到数据库的语句不会自动回滚。 + + +如果脚本需要整体原子性,建议脚本本身包含事务控制,并确认目标数据库支持相关事务语义。 + + +## 执行前检查 + +- 当前连接是否是预期环境 +- 脚本是否来自可信来源 +- 是否包含 `DROP`、`TRUNCATE`、大范围 `UPDATE` 或 `DELETE` +- 是否需要先在测试环境执行 +- 是否需要启用“遇错继续” +- 是否需要先使用 [数据库导出](/cn/docs/database-export) 备份 diff --git a/docs/content/docs/sql-file.mdx b/docs/content/docs/sql-file.mdx index e2581ef3a5..bfbd08c92b 100644 --- a/docs/content/docs/sql-file.mdx +++ b/docs/content/docs/sql-file.mdx @@ -1,41 +1,70 @@ --- title: SQL File Execution -description: Run .sql files with smart statement splitting, progress tracking, and cancellation support. +description: Execute .sql files against a selected connection, monitor progress, and cancel remaining statements when needed. --- - -Execute `.sql` files directly with smart statement splitting (handles functions, triggers, quoted strings), real-time progress tracking, and cancellation. +SQL File Execution runs local `.sql` scripts in DBX. Use it for initialization scripts, data patches, database dumps, and migration scripts. + + +SQL files may modify large amounts of data or schema. Confirm the target connection, target database, and script source before running. Back up production databases first. -## Running a SQL File +## Workflow - ### Open the Panel - Open the SQL File Execution panel. + ### Open SQL File Execution + + Open the SQL file execution panel in DBX. - ### Select File - Choose a `.sql` file from your filesystem. + ### Choose a File + + Select a local `.sql` file. Large files may take longer to parse and execute. - ### Choose Target - Select the target connection and database. + ### Select Target Connection + + Choose the connection and database where the script should run. - ### Execute - Click execute and monitor progress in real time. + ### Start Execution + + DBX executes the script statement by statement and shows progress. + + + ### Check Results + + After execution, review successful statements, failed statements, and error messages. -## Smart Statement Splitting +## Statement Splitting -DBX parses SQL files intelligently rather than naively splitting on semicolons: +DBX reads SQL files as a stream and tries to detect statement boundaries correctly instead of splitting on every semicolon: -- **Functions and procedures** — `BEGIN...END` blocks are treated as a single unit -- **Triggers** — `CREATE TRIGGER` statements with embedded logic are kept intact -- **Quoted strings** — Semicolons inside string literals are not treated as delimiters +- Semicolons inside strings are not treated as statement endings +- Semicolons inside line and block comments are ignored +- PostgreSQL dollar-quoted function bodies are kept together +- MySQL executable comments are treated as executable statements + +## Error Handling + +By default, execution stops when a statement fails. You can enable continue-on-error to keep running later statements while recording failures. ## Cancelling Execution -Click the cancel button to stop execution before the file finishes. Statements already executed are not rolled back — only subsequent statements are skipped. +You can cancel while execution is running. Cancelling stops later statements from running, but statements already submitted to the database are not rolled back automatically. + + +If a script must be atomic, include transaction control in the script itself and confirm the target database supports the required transaction behavior. + + +## Before Running + +- Confirm the active connection is the intended environment +- Verify the script comes from a trusted source +- Look for `DROP`, `TRUNCATE`, broad `UPDATE`, or broad `DELETE` +- Run the script in a test environment first when possible +- Decide whether continue-on-error is appropriate +- Back up with [Database Export](/en/docs/database-export) when needed diff --git a/docs/content/docs/table-import.cn.mdx b/docs/content/docs/table-import.cn.mdx index ef8f85cc25..3773e2ccac 100644 --- a/docs/content/docs/table-import.cn.mdx +++ b/docs/content/docs/table-import.cn.mdx @@ -1,49 +1,74 @@ --- title: 表数据导入 -description: 导入 CSV、TSV、JSON、Excel 文件到数据库表,自动列映射。 +description: 将 CSV、TSV、JSON 或 Excel 文件导入数据库表,并检查列映射和导入模式。 --- - -支持 CSV、TSV、JSON、Excel 文件导入,自动匹配列名,可选追加或清空后导入。 - +表数据导入用于把本地文件写入指定表。它适合一次性导入测试数据、业务数据补录、从表格工具迁移数据等场景。 -## 支持的文件格式 +## 支持的文件 | 格式 | 说明 | |---|---| -| CSV | 逗号分隔的文本文件 | -| TSV | 制表符分隔的文本文件 | -| JSON | JSON 数组格式 | -| Excel | `.xlsx` 格式 | +| CSV | 逗号分隔文本,适合通用数据交换 | +| TSV | 制表符分隔文本,适合字段中包含逗号的场景 | +| JSON | JSON 数组,适合从接口或脚本导出的数据 | +| Excel | `.xlsx` 或 `.xls` 文件 | -## 使用方式 +## 导入流程 ### 选择目标表 - 在目标表上右键,选择"导入数据"。 + + 在侧边栏中右键目标表,选择 **导入数据**。 ### 选择文件 - 选择要导入的文件。 + + 选择要导入的 CSV、TSV、JSON 或 Excel 文件。 - ### 确认列映射 - DBX 自动将文件中的列与目标表的字段按名称匹配。你可以手动调整映射关系,不需要导入的列可以取消映射。 + ### 检查列映射 + + DBX 会按列名尝试匹配文件字段和数据库字段。请检查主键、必填字段、日期字段和数值字段。 - ### 选择模式并导入 - 选择导入模式后,点击"开始导入"。 + ### 选择导入模式 + + 选择追加或清空后导入。清空模式会先删除目标表已有数据。 + + + ### 执行并检查结果 + + 导入完成后检查成功行数、失败原因和目标表数据。 ## 导入模式 -| 模式 | 说明 | -|---|---| -| **追加** | 将文件数据追加到现有数据之后 | -| **清空后导入** | 先清空表中所有数据,再导入文件内容 | +| 模式 | 行为 | 适合场景 | +|---|---|---| +| 追加 | 保留原有数据,继续插入新行 | 补充数据、追加样例数据 | +| 清空后导入 | 先清空目标表,再导入文件内容 | 重建测试表、替换临时数据 | -清空模式会永久删除目标表中的所有现有数据。请确认这是你的预期操作。 +清空后导入会删除目标表中的现有数据。生产环境使用前请确认备份和影响范围。 + +## 导入前检查 + +- 文件首行是否是列名 +- 字符编码是否正确 +- 日期、数字、布尔值格式是否符合目标数据库要求 +- 非空字段是否都有值 +- 唯一索引和主键是否会冲突 +- 是否需要先导入父表,再导入带外键的子表 + +## 常见问题 + +| 现象 | 可能原因 | +|---|---| +| 部分列没有导入 | 文件列名和表字段名不匹配,或列被取消映射 | +| 导入失败 | 非空字段为空、类型不匹配、主键冲突或唯一约束冲突 | +| 中文乱码 | 文件编码和解析方式不一致 | +| 日期错误 | 文件中的日期格式无法被目标数据库识别 | diff --git a/docs/content/docs/table-import.mdx b/docs/content/docs/table-import.mdx index 0d644c884e..64fb2fb54f 100644 --- a/docs/content/docs/table-import.mdx +++ b/docs/content/docs/table-import.mdx @@ -1,49 +1,74 @@ --- title: Table Import -description: Import CSV, TSV, JSON, and Excel files into database tables with automatic column mapping. +description: Import CSV, TSV, JSON, or Excel files into a table with reviewed column mapping and import mode. --- - -Import CSV, TSV, JSON, and Excel files with automatic column name matching. Choose between append and truncate modes. - +Table Import writes a local file into a selected database table. Use it for one-off test data, operational data backfills, or moving data out of spreadsheet tools. -## Supported Formats +## Supported Files -| Format | Extensions | +| Format | Details | |---|---| -| CSV | `.csv` | -| TSV | `.tsv` | -| JSON | `.json` | -| Excel | `.xlsx`, `.xls` | +| CSV | Comma-separated text for general data exchange | +| TSV | Tab-separated text, useful when values contain commas | +| JSON | JSON arrays exported from APIs or scripts | +| Excel | `.xlsx` or `.xls` files | ## Import Workflow - ### Select Target Table - Right-click the target table and select "Import Data". + ### Select the Target Table + + Right-click the target table in the sidebar and choose **Import Data**. - ### Choose File - Select the file to import. + ### Choose a File + + Select a CSV, TSV, JSON, or Excel file. ### Review Column Mapping - DBX auto-maps file columns to table columns by name. Adjust mappings manually if names don't match. Unmapped columns are skipped. + + DBX tries to match file columns to table columns by name. Check primary keys, required fields, dates, and numeric values. - ### Select Mode and Import - Choose the import mode and click "Start Import". + ### Choose Import Mode + + Select append or truncate-then-import. Truncate mode removes existing target data first. + + + ### Run and Inspect + + After import, check inserted rows, failures, and the resulting table data. ## Import Modes -| Mode | Behavior | -|---|---| -| **Append** | Insert rows alongside existing data | -| **Truncate then import** | Delete all existing rows first, then insert | +| Mode | Behavior | Best For | +|---|---|---| +| Append | Keep existing data and insert new rows | Backfills and sample data | +| Truncate then import | Remove existing rows first, then insert file data | Rebuilding test tables or replacing temporary data | -Truncate mode permanently removes all existing data in the target table. Make sure this is the intended behavior. +Truncate-then-import deletes existing rows from the target table. Confirm backups and impact before using it on production data. + +## Before Importing + +- Confirm whether the first row contains column names +- Check file encoding +- Verify date, number, and boolean formats +- Ensure required fields have values +- Check for primary key and unique index conflicts +- Import parent tables before child tables when foreign keys are involved + +## Troubleshooting + +| Symptom | Possible Cause | +|---|---| +| Some columns are skipped | File column names do not match table columns, or the mapping was disabled | +| Import fails | Required value missing, type mismatch, primary key conflict, or unique constraint conflict | +| Text is garbled | File encoding does not match parser settings | +| Dates are wrong | Date format is not recognized by the target database | diff --git a/docs/content/docs/table-structure.cn.mdx b/docs/content/docs/table-structure.cn.mdx index a2756153b4..48390a40eb 100644 --- a/docs/content/docs/table-structure.cn.mdx +++ b/docs/content/docs/table-structure.cn.mdx @@ -1,43 +1,61 @@ --- title: 表结构编辑器 -description: 可视化管理表的列和索引,无需手写 DDL,保存前预览 ALTER TABLE 语句。 +description: 可视化编辑表字段和索引,并在保存前预览 DDL。 --- - -可视化编辑表结构,无需手写 `ALTER TABLE`。所有变更保存前可预览完整的 DDL 语句。 - +表结构编辑器用于修改单张表的字段、索引和部分约束。它适合小范围结构调整,也适合在不手写 DDL 的情况下生成可审查的变更 SQL。 -## 列编辑 +## 可以编辑什么 -在表结构编辑器中,通过可视化界面管理表的列: - -- **添加列** — 设置列名、数据类型、是否允许 NULL、默认值等属性 -- **修改列** — 直接编辑已有列的属性,包括重命名、更改类型、调整默认值 -- **删除列** — 选中列后标记待移除 - -所有修改不会立即生效,而是暂存在本地等待确认。 - -## 索引管理 - -在同一界面中管理表的索引: - -- 添加新索引,指定索引列和索引类型(普通索引、唯一索引等) -- 修改已有索引的配置 -- 删除不再需要的索引 - -## SQL 预览 - - -在点击"应用"之前,DBX 会展示即将执行的 `ALTER TABLE` 语句,包括 `ADD COLUMN`、`MODIFY COLUMN`、`DROP COLUMN`、`CREATE INDEX` 等。确认无误后再执行。 - - -## 数据库支持 - -| 数据库 | 支持情况 | +| 对象 | 支持操作 | |---|---| -| MySQL | 完整支持 | -| PostgreSQL | 完整支持 | -| SQLite | 完整支持 | -| SQL Server | 完整支持 | +| 字段 | 新增、删除;MySQL/PostgreSQL 支持修改已有字段,SQLite 支持重命名字段 | +| 索引 | 新增索引、删除已有非主键索引 | +| 注释 | MySQL/PostgreSQL 支持字段注释写入;PostgreSQL 支持索引注释 | -DBX 会根据每种引擎的特性自动适配。例如,SQLite 有限的 `ALTER TABLE` 能力由 DBX 透明处理。 +不同数据库的 DDL 能力不完全一致,DBX 会按当前连接类型生成对应语法。 + +## 工作流 + + + + ### 打开表结构 + + 在侧边栏右键表,选择查看或编辑结构。 + + + ### 修改字段或索引 + + 在可视化界面中添加、修改或删除字段和索引。修改会先暂存在本地。 + + + ### 查看 SQL 预览 + + 保存前检查 DBX 生成的 `ALTER TABLE`、`CREATE INDEX`、`DROP INDEX` 等语句。 + + + ### 确认执行 + + 确认 SQL 没有问题后再应用到数据库。 + + + + +删除字段、修改字段类型、修改 NULL 约束都可能影响现有数据。生产环境执行前建议先备份,并确认应用代码是否依赖旧结构。 + + +## 数据库差异 + +| 数据库 | 说明 | +|---|---| +| MySQL / MariaDB | 支持新增、删除、修改字段,以及新增/删除索引 | +| PostgreSQL | 支持字段重命名、类型、默认值、NULL 约束和注释变更,以及新增/删除索引 | +| SQLite | 支持新增字段、删除字段和重命名字段;更复杂的字段修改会提示无法安全处理 | +| SQL Server / Oracle 等 | 可新增字段和索引;修改已有字段时会提示当前编辑器暂不支持 | + +## 使用建议 + +- 小改动可以直接使用表结构编辑器 +- 大规模结构迁移建议生成 SQL 后进入代码仓库审查 +- 多环境同步建议配合 [Schema 对比](/cn/docs/schema-diff) +- 不确定影响范围时,先通过 [数据库导出](/cn/docs/database-export) 备份 diff --git a/docs/content/docs/table-structure.mdx b/docs/content/docs/table-structure.mdx index 29a35ad2c2..65ab0182bc 100644 --- a/docs/content/docs/table-structure.mdx +++ b/docs/content/docs/table-structure.mdx @@ -1,43 +1,61 @@ --- title: Table Structure Editor -description: Visually manage columns and indexes without writing DDL. Preview ALTER TABLE statements before applying. +description: Edit table columns and indexes visually, then preview DDL before applying changes. --- - -Edit table structure visually — no `ALTER TABLE` by hand. All changes are previewed as SQL before execution. - +The table structure editor modifies columns, indexes, and some constraints for a single table. Use it for focused structure changes or to generate reviewable DDL without writing it by hand. -## Column Editor +## What You Can Edit -Manage columns through a visual interface: - -- **Add column** — Set name, type, nullable, default, and comment -- **Modify column** — Rename, change type, adjust defaults -- **Delete column** — Mark for removal - -All changes are staged locally until you confirm. - -## Index Management - -Manage indexes in the same interface: - -- Create new indexes (unique, non-unique) with selected columns -- Modify existing index configurations -- Remove indexes - -## SQL Preview - - -Before applying, DBX shows the exact `ALTER TABLE` statements — `ADD COLUMN`, `MODIFY COLUMN`, `DROP COLUMN`, `CREATE INDEX`, etc. Review and confirm before committing. - - -## Database Support - -| Engine | Support | +| Object | Supported Actions | |---|---| -| MySQL | Full | -| PostgreSQL | Full | -| SQLite | Full | -| SQL Server | Full | +| Columns | Add and delete columns; MySQL/PostgreSQL can modify existing columns, and SQLite can rename columns | +| Indexes | Add indexes and delete existing non-primary indexes | +| Comments | MySQL/PostgreSQL can write column comments; PostgreSQL can write index comments | -Behavior adapts to the capabilities of each engine. For example, SQLite's limited `ALTER TABLE` support is handled transparently by DBX. +Database engines differ in DDL capabilities. DBX generates SQL for the active connection type. + +## Workflow + + + + ### Open Table Structure + + Right-click a table in the sidebar and open its structure view. + + + ### Edit Columns or Indexes + + Add, modify, or remove columns and indexes in the visual editor. Changes are staged locally first. + + + ### Review SQL Preview + + Before saving, review generated statements such as `ALTER TABLE`, `CREATE INDEX`, and `DROP INDEX`. + + + ### Apply Changes + + Execute the SQL only after confirming it matches your intent. + + + + +Dropping columns, changing column types, and changing nullable constraints can affect existing data. Back up production databases first and confirm application code does not depend on the old structure. + + +## Engine Differences + +| Engine | Notes | +|---|---| +| MySQL / MariaDB | Add, delete, and modify columns; add and delete indexes | +| PostgreSQL | Rename columns, change type/default/nullability/comments, and add/delete indexes | +| SQLite | Add, delete, and rename columns; more complex existing-column edits are blocked with a warning | +| SQL Server / Oracle and others | Adding columns and indexes is available; editing existing columns is currently blocked by the editor | + +## Recommendations + +- Use the editor for small, focused changes +- For large migrations, generate SQL and review it in your code repository +- For environment sync, use [Schema Diff](/en/docs/schema-diff) +- When impact is uncertain, back up first with [Database Export](/en/docs/database-export) diff --git a/docs/content/docs/what-is-dbx.cn.mdx b/docs/content/docs/what-is-dbx.cn.mdx index 7469a9f82e..c3ca5543d2 100644 --- a/docs/content/docs/what-is-dbx.cn.mdx +++ b/docs/content/docs/what-is-dbx.cn.mdx @@ -1,79 +1,68 @@ --- title: 什么是 DBX? -description: 开源、轻量、AI 驱动的数据库管理工具,15 MB 管理 25+ 种数据库。 +description: DBX 是一个开源数据库工作台,覆盖连接管理、SQL 编辑、数据浏览、结构工具、AI 助手和自托管访问。 --- - -15 MB 安装包,25+ 种数据库,内置 AI 助手,桌面 + Docker 双模式部署。 - +DBX 是一个开源数据库工作台。它把日常数据库工作里的高频动作放在同一个界面里:连接数据库、写 SQL、查看和编辑数据、浏览结构、对比 Schema、导入导出数据,以及在需要时让 AI 辅助分析。 -DBX 是一款开源、轻量、跨平台的数据库管理工具,基于 [Tauri 2](https://tauri.app/) 和 Rust 构建。无需内嵌 Chromium,安装包仅 15 MB,却能管理 MySQL、PostgreSQL、MongoDB、Redis 等 25+ 种数据库。 +它同时提供桌面应用和 Docker 版本。桌面应用适合本机开发和日常连接管理;Docker 版本适合在服务器上自托管,通过浏览器访问同一套能力。 ![DBX 截图](/screenshot-dark.png) -## 为什么选择 DBX? +## 适合的场景 - - ~15 MB 安装包,不内嵌 Chromium。Tauri 2 + Rust 原生性能,启动秒开。 + + 使用 SQL 编辑器编写、格式化和执行查询,并通过查询历史快速找回之前的排查过程。 - - 一个工具管理 MySQL、PostgreSQL、SQLite、Redis、MongoDB、ClickHouse、SQL Server、Oracle 等 25+ 种数据库。 + + 在数据表格中筛选、排序、编辑、预览 SQL,再决定是否写入数据库。 - - 内置 AI 助手:自然语言转 SQL、查询优化、错误修复。MCP Server 让 Claude/Cursor 直接查询你的数据库。 + + 通过侧边栏浏览数据库、Schema、表、字段、索引、外键和触发器,适合接手陌生库时快速定位对象。 - - 密码存储在系统钥匙串(macOS Keychain / Windows Credential Manager),SSH 隧道,AES-256-GCM 加密配置导出。 + + 对比开发、测试、生产等环境之间的结构差异,生成可审查的同步 SQL。 -## 核心功能 +## 主要能力 - - - CodeMirror 6 驱动,语法高亮、智能补全、JOIN 建议、查询历史。 - - - 虚拟滚动 10 万行不卡顿,行内编辑,WHERE/ORDER BY 过滤,复制为 INSERT,保存前预览 SQL。 - - - 树形视图,搜索、置顶、右键菜单、创建/删除数据库和 Schema、字段注释、连接颜色标记。 - - - 跨数据库结构对比,自动生成同步 SQL,开发 vs 生产一键对齐。 - - - 跨引擎迁移 — MySQL → PostgreSQL,自动处理类型映射。 - - - 追踪外键、视图、查询历史中的字段关联,标注置信度。 - - - -## 与竞品对比 - -| | DBX | DBeaver | Navicat | TablePlus | -|---|---|---|---|---| -| **安装体积** | ~15 MB | ~300 MB | ~200 MB | ~80 MB | -| **价格** | 免费 (AGPL) | 免费 / $230 | $180+ | $99+ | -| **数据库支持** | 25+ | 80+ | 15+ | 20+ | -| **内置 AI** | ✅ | ❌ | ✅ | ❌ | -| **MCP 集成** | ✅ | ❌ | ❌ | ❌ | -| **Docker 自托管** | ✅ | ❌ | ❌ | ❌ | -| **字段血缘** | ✅ | ❌ | ❌ | ❌ | -| **Schema 对比** | ✅ | ✅ | ✅ | ❌ | - -## 技术栈 - -| 层级 | 技术 | +| 能力 | 说明 | |---|---| -| 框架 | [Tauri 2](https://tauri.app/) | -| 前端 | [Vue 3](https://vuejs.org/) + TypeScript | -| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS | -| 编辑器 | [CodeMirror 6](https://codemirror.net/) | -| 后端 | Rust + sqlx / tiberius / redis-rs / mongodb | +| 多数据库连接 | 支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、DuckDB、ClickHouse、SQL Server、Oracle 等数据库 | +| SQL 编辑器 | 基于 CodeMirror 6,支持语法高亮、元数据补全、格式化、选中执行和查询历史 | +| 数据表格 | 虚拟滚动、行内编辑、WHERE/ORDER BY 控制、SQL 预览和多格式导出 | +| 结构工具 | 表结构编辑、Schema 对比、ER 图、字段血缘、数据库导出和 SQL 文件执行 | +| AI 辅助 | 根据当前连接的元数据生成 SQL、解释查询、优化语句、辅助修复错误 | +| 自托管访问 | Docker 版本可部署在服务器上,通过浏览器访问 DBX | -## 开源协议 +## 设计取向 -[AGPL-3.0](https://github.com/t8y2/dbx/blob/main/LICENSE) +DBX 优先覆盖数据库客户端里的核心工作流,而不是把所有数据库管理场景都塞进一个复杂入口。它更关注这些细节: + +- **少切换上下文**:结构浏览、SQL 编辑、数据表格和结果查看尽量在同一工作区内完成。 +- **操作可审查**:涉及数据或结构变更时,尽量先展示将要执行的 SQL。 +- **多环境可区分**:连接颜色、置顶、搜索和上下文菜单帮助区分开发、测试和生产环境。 +- **轻量部署**:桌面版适合个人日常工作,Docker 版适合团队或服务器环境。 + +## 数据与安全 + +- 连接配置保存在本机应用数据目录的 SQLite 数据库中,密码、SSH 密码、SSH 密钥密码等敏感字段会从普通连接配置中拆出,单独存放在 `connection_secrets` 表。 +- 配置导出支持 AES-GCM 加密,适合在多台设备之间迁移连接。 +- SSH 隧道可以连接私有网络或防火墙后的数据库。 +- DBX 不会自动执行 AI 生成的 SQL;执行前仍需要用户确认。 + +## 下一步 + + + + 从桌面应用或 Docker 版本开始,创建第一个数据库连接。 + + + 了解不同数据库引擎、兼容协议和 ODBC 场景的支持情况。 + + + 设置 API Key 后,在 SQL 编辑器中使用自然语言生成和解释查询。 + + diff --git a/docs/content/docs/what-is-dbx.mdx b/docs/content/docs/what-is-dbx.mdx index 04c9ff2452..de692302ca 100644 --- a/docs/content/docs/what-is-dbx.mdx +++ b/docs/content/docs/what-is-dbx.mdx @@ -1,79 +1,68 @@ --- title: What is DBX? -description: Open-source, lightweight, AI-powered database management tool. 15 MB for 25+ databases. +description: DBX is an open-source database workspace for connections, SQL editing, data grids, schema tools, AI assistance, and self-hosted access. --- - -15 MB install size. 25+ database engines. Built-in AI assistant. Desktop + Docker deployment. - +DBX is an open-source database workspace. It brings the daily database workflow into one place: connecting to databases, writing SQL, browsing and editing data, exploring schemas, comparing structures, importing and exporting data, and using AI assistance when it helps. -DBX is an open-source, lightweight, cross-platform database management tool built with [Tauri 2](https://tauri.app/) and Rust. No bundled Chromium — just a 15 MB installer that manages MySQL, PostgreSQL, MongoDB, Redis, and 25+ more databases. +DBX is available as both a desktop app and a Docker deployment. Use the desktop app for local daily work, or self-host the Docker version when you want browser-based access from a server. ![DBX Screenshot](/screenshot-dark.png) -## Why DBX? +## Where DBX Fits - - ~15 MB installer, no Chromium. Tauri 2 + Rust for native performance and instant startup. + + Write, format, and execute SQL, then use query history to return to previous investigation steps. - - One tool for MySQL, PostgreSQL, SQLite, Redis, MongoDB, ClickHouse, SQL Server, Oracle, and more. + + Filter, sort, edit, preview SQL, and decide when changes should be committed to the database. - - Built-in AI assistant: natural language to SQL, query optimization, error fixing. MCP Server lets Claude/Cursor query your databases directly. + + Browse databases, schemas, tables, columns, indexes, foreign keys, and triggers from the sidebar. - - Passwords in system keyring (macOS Keychain / Windows Credential Manager). SSH tunnels and AES-256-GCM encrypted config export. + + Compare dev, staging, and production schemas, then generate SQL you can review before syncing. -## Key Features +## Core Capabilities - - - Powered by CodeMirror 6. Syntax highlighting, smart autocomplete, JOIN suggestions, query history. - - - Virtual scrolling for 100K+ rows. Inline editing, WHERE/ORDER BY filtering, Copy as INSERT, SQL preview before saving. - - - Tree view with search, pin, context menus, create/drop databases and schemas, column comments, and connection colors. - - - Compare schemas across databases and generate sync SQL. Dev vs Production in one click. - - - Cross-engine migration — MySQL to PostgreSQL with automatic type mapping. - - - Trace column relationships across foreign keys, views, and query history with confidence levels. - - - -## How DBX Compares - -| | DBX | DBeaver | Navicat | TablePlus | -|---|---|---|---|---| -| **Install Size** | ~15 MB | ~300 MB | ~200 MB | ~80 MB | -| **Price** | Free (AGPL) | Free / $230 | $180+ | $99+ | -| **Database Support** | 25+ | 80+ | 15+ | 20+ | -| **Built-in AI** | ✅ | ❌ | ✅ | ❌ | -| **MCP Integration** | ✅ | ❌ | ❌ | ❌ | -| **Docker Self-Host** | ✅ | ❌ | ❌ | ❌ | -| **Field Lineage** | ✅ | ❌ | ❌ | ❌ | -| **Schema Diff** | ✅ | ✅ | ✅ | ❌ | - -## Tech Stack - -| Layer | Technology | +| Capability | Details | |---|---| -| Framework | [Tauri 2](https://tauri.app/) | -| Frontend | [Vue 3](https://vuejs.org/) + TypeScript | -| UI | [shadcn-vue](https://www.shadcn-vue.com/) + Tailwind CSS | -| Editor | [CodeMirror 6](https://codemirror.net/) | -| Backend | Rust + sqlx / tiberius / redis-rs / mongodb | +| Database connections | MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, ClickHouse, SQL Server, Oracle, and more | +| SQL editor | CodeMirror 6, syntax highlighting, metadata completion, formatting, selected execution, and query history | +| Data grid | Virtual scrolling, inline editing, WHERE/ORDER BY controls, SQL preview, and export tools | +| Schema tools | Table structure editing, schema diff, ER diagrams, field lineage, database export, and SQL file execution | +| AI assistance | Generate SQL, explain queries, suggest optimizations, and help fix errors using connection metadata | +| Self-hosted access | Run DBX with Docker and access it from a browser | -## License +## Product Principles -[AGPL-3.0](https://github.com/t8y2/dbx/blob/main/LICENSE) +DBX focuses on the core work of a database client instead of turning every operation into a separate tool. A few details shape the product: + +- **Less context switching**: schema browsing, SQL editing, data grids, and results stay close together. +- **Reviewable operations**: data and schema changes show the SQL before they are applied where possible. +- **Clear environment separation**: connection colors, pins, search, and context menus help separate dev, test, and production. +- **Flexible deployment**: the desktop app fits personal workflows; the Docker version fits shared or server-hosted access. + +## Data and Security + +- Connection configuration is stored in a local SQLite database under the app data directory. Sensitive fields such as passwords, SSH passwords, SSH key passphrases, and connection strings are removed from the normal connection JSON and stored separately in the `connection_secrets` table. +- Config export can be encrypted with AES-GCM for migration between machines. +- SSH tunnels can connect to databases behind firewalls or private networks. +- DBX does not automatically execute AI-generated SQL; the user still reviews and runs it. + +## Next Steps + + + + Start with the desktop app or Docker version, then create your first database connection. + + + Check supported engines, compatible protocols, and ODBC-specific setup. + + + Add an API key and use natural language in the SQL editor. + +