Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(duckdb): allow opening non-existent database files

t8y29ae4d4b59ed6
diff --git a/crates/dbx-core/src/db/duckdb_driver.rs b/crates/dbx-core/src/db/duckdb_driver.rs
index 8ef56bea71..d64ee97519 100644
--- a/crates/dbx-core/src/db/duckdb_driver.rs
+++ b/crates/dbx-core/src/db/duckdb_driver.rs
@@ -39,7 +39,13 @@ fn validate_duckdb_path(path: &str) -> Result<(), String> {
return Err(format!("Database file path is a directory, not a file: {}", path));
}
if !path_obj.exists() {
- return Err(format!("Database file does not exist: {}", path));
+ // DuckDB creates a new database file on open when the parent directory
+ // exists. Only reject paths whose parent directory is missing.
+ if let Some(parent) = path_obj.parent() {
+ if !parent.as_os_str().is_empty() && !parent.exists() {
+ return Err(format!("Parent directory does not exist: {}", parent.display()));
+ }
+ }
}
Ok(())
}