Add DuckDB connector with execute_sql and search_objects support - #445
Open
solutionsDigibull wants to merge 3 commits into
Open
solutionsDigibull wants to merge 3 commits into
solutionsDigibull wants to merge 3 commits into
Conversation
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.
Contributor
There was a problem hiding this comment.
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
Open (19)
Remove and rotate committed PostgreSQL credentials · New Bind table and schema filters in catalog queries · New Prevent SQL injection in index search filters · New Enforce DuckDB read-only execution · New Split DuckDB multi-statement batches into result sets · New Block DuckDB PRAGMA statements in read-only mode · New Use DuckDB's correct positional placeholder identifier · New Support file-based DuckDB sources in connection parameters · New Allow extensionless DuckDB database paths · New Exclude views from DuckDB table discovery · New Parse DuckDB index expressions into column arrays · New Limit DuckDB rows before materializing results · New Support DuckDB in DSN and environment configuration · New Remove eager DuckDB native import from DSN utilities · New Parse DuckDB database paths from DSNs · New Remove and rotate credentials repeated in documentation · New Replace embedded Bifrost credentials in documentation · New Correct DuckDB connection schema field descriptions · New Add automated integration coverage for DuckDB · New
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.
| [[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 }; | ||
| } |
| [[sources]] | ||
| id = "postgres_logic" | ||
| description = "Production PostgreSQL database" | ||
| dsn = "postgresql://postgres:DigiBull@192.168.1.18:5432/logic_db_2?sslmode=disable" |
|
|
||
| ```powershell | ||
| $headers = @{ | ||
| "Authorization" = "Bearer <base64(DigiBull:DigiBull@2026)>" |
| type: | ||
| type: string | ||
| enum: [postgres, mysql, mariadb, sqlserver, sqlite, oracle] | ||
| enum: [postgres, mysql, mariadb, sqlserver, sqlite, oracle,duckdb] |
| // ------------------------------------------------------------ | ||
| // Connector | ||
| // ------------------------------------------------------------ | ||
| class DuckDBConnector implements Connector { |
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.



Added the connectors and relevant changes for DuckDB support