Skip to content

Add DuckDB connector with execute_sql and search_objects support - #445

Open
solutionsDigibull wants to merge 3 commits into
bytebase:mainfrom
solutionsDigibull:duckdb-connector
Open

solutionsDigibull wants to merge 3 commits into
bytebase:mainfrom
solutionsDigibull:duckdb-connector

Conversation

@solutionsDigibull

Copy link
Copy Markdown

Added the connectors and relevant changes for DuckDB support

@tianzhou

Copy link
Copy Markdown
Member

Please open an issue first

Added toml and implementation of the TXT to sql via MCP tools registered in bifrost
Updated PowerShell script for DBHub MCP tool-call pipeline, including changes to authorization headers, model usage, and JSON parsing for tool results.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Committed credentials and unresolved read-only, configuration, query-safety, and execution-contract defects block approval.

Review effort: Balanced
Findings: 7 High severity · 8 Medium severity · 4 Low severity

Open (19)
What changed in this PR

Adds DuckDB support across connector execution, schema discovery, configuration types, API metadata, and dependencies.

Changes:

  • Implements DuckDB connection, query execution, and object discovery.
  • Registers DuckDB across SQL utilities, configuration, and OpenAPI types.
  • Adds example configuration and deployment handoff documentation.
File Description
src/​connectors/​duckdb/​index.ts Implements the DuckDB connector.
src/​connectors/​interface.ts Adds the DuckDB connector type.
src/​index.ts Registers the DuckDB module.
src/​types/​config.ts Adds DuckDB configuration typing.
src/​config/​toml-loader.ts Accepts DuckDB TOML sources.
src/​utils/​sql-parser.ts Selects DuckDB SQL scanning rules.
src/​utils/​parameter-mapper.ts Adds DuckDB parameter style.
src/​utils/​error-classifier.ts Adds DuckDB error classification.
src/​utils/​dsn-obfuscate.ts Recognizes DuckDB DSNs.
src/​utils/​allowed-keywords.ts Adds DuckDB read-only rules.
src/​api/​openapi.yaml Exposes DuckDB through OpenAPI.
src/​api/​openapi.d.ts Updates generated API types.
package.json Adds the DuckDB driver.
pnpm-lock.yaml Locks DuckDB native packages.
dbhub.toml Adds local source examples.
DBHub_MCP_TXTtoSQL.md Documents the local integration setup.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dbhub.toml
[[sources]]
id = "postgres_logic"
description = "Production PostgreSQL database"
dsn = "postgresql://postgres:DigiBull@192.168.1.18:5432/logic_db_2?sslmode=disable"
Comment on lines +114 to +117
`SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_schema = '${target}' AND table_name = '${tableName}'
ORDER BY ordinal_position`
Comment on lines +141 to +143
`SELECT index_name, is_unique, is_primary, expressions
FROM duckdb_indexes()
WHERE schema_name = '${target}' AND table_name = '${tableName}'`
Comment on lines +181 to +185
async executeSQL(
sql: string,
options: ExecuteOptions,
parameters?: any[]
): Promise<SQLResult> {
Comment on lines +190 to +192
} else {
result = await this.connection!.run(sql);
}
Comment on lines +58 to +60
if (type === 'duckdb') {
return { type };
}
Comment thread DBHub_MCP_TXTtoSQL.md
[[sources]]
id = "postgres_logic"
description = "Production PostgreSQL database"
dsn = "postgresql://postgres:DigiBull@192.168.1.18:5432/logic_db_2?sslmode=disable"
Comment thread DBHub_MCP_TXTtoSQL.md

```powershell
$headers = @{
"Authorization" = "Bearer <base64(DigiBull:DigiBull@2026)>"
Comment thread src/api/openapi.yaml
type:
type: string
enum: [postgres, mysql, mariadb, sqlserver, sqlite, oracle]
enum: [postgres, mysql, mariadb, sqlserver, sqlite, oracle,duckdb]
// ------------------------------------------------------------
// Connector
// ------------------------------------------------------------
class DuckDBConnector implements Connector {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants