[Fix] Fix DuckDB datasource creation from Web UI - #3009
Merged
Aries-ckt merged 2 commits intoApr 2, 2026
Conversation
Collaborator
|
Thank you for your feedback! For version information, please see:- Latest stable version: v0.7.5 (2025-02-11)- View all releases: https://github.com/eosphoros-ai/DB-GPT/releasesWe recommend upgrading to the latest version to get the latest features and fixes. |
chenliang15405
approved these changes
Apr 2, 2026
chenliang15405
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for your contribution, LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3008
PR Description / PR 描述
Summary / 摘要
This PR fixes the issue where DuckDB datasources could not be correctly created or initialized from the Web UI. It ensures proper URI formatting and prevents schema-related SQL errors for DuckDB connections.
此 PR 修复了从 Web 界面创建或初始化 DuckDB 数据源失败的问题。主要通过修正 URI 格式化逻辑以及处理 DuckDB 在 SQL 执行中的 Schema 兼容性来解决。
Problem / 问题描述
Incorrect URI Initialization: The
DuckDbConnectorwas using a raw file path instead of a properly formatted DB URL when being created from parameters, leading to connection failures.Schema Incompatibility: In
RDBMSConnector, DuckDB was not treated as a "schema-less" database (like SQLite). Passing a database name as a schema triggered errors during certain SQL operations.URI 初始化错误:
DuckDbConnector在从参数创建时直接使用了原始文件路径,而非格式化后的 DB URL,导致连接失败。Schema 不兼容: 在
RDBMSConnector中,DuckDB 未像 SQLite 一样被视为“无 Schema”数据库。在某些 SQL 操作中传递数据库名作为 Schema 会触发错误。Solution / 解决方案
Update URI Construction: Changed
DuckDbConnector.from_parametersto useparameters.db_url()instead ofparameters.path, ensuring the URI matches the required format for DuckDB.Adjust Schema Logic: Updated
RDBMSConnectorto set_schematoNonefor DuckDB (matching SQLite behavior) to prevent SQL execution errors related to database/schema scoping.更新 URI 构建: 将
DuckDbConnector.from_parameters更改为使用parameters.db_url()而非parameters.path,确保生成的 URI 符合 DuckDB 的要求。调整 Schema 逻辑: 在
RDBMSConnector中,将 DuckDB 设置为与 SQLite 相同的处理逻辑(即_schema为None),以避免与数据库/模式范围相关的 SQL 执行错误。How Has This Been Tested?
The fix has been verified after adopting the changes from duckdb_engine PR #1393.
Test Environment:
Manual Verification: Successfully created a DuckDB datasource via the Web UI and verified the connection and metadata retrieval.
该修复在采纳了 duckdb_engine PR #1393 的更改后进行了验证。
测试环境:
手动验证: 通过 Web 界面成功创建 DuckDB 数据源,并验证了连接及元数据获取。
Snapshots:
N/A
Checklist: