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。

feat(databend): support agent driver

t8y274e19ec6a3e2
diff --git a/apps/desktop/public/icons/database/databend.svg b/apps/desktop/public/icons/database/databend.svg
new file mode 100644
index 0000000000..ab3b97498b
--- /dev/null
+++ b/apps/desktop/public/icons/database/databend.svg
@@ -0,0 +1,16 @@
+<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_9_11)">
+<path d="M46.8741 35.0248C46.5214 35.3778 45.1611 34.1675 44.695 33.4741C44.7832 34.3188 44.4683 36.0207 44.0526 36.0081C43.2591 35.9829 42.7427 33.6884 43.045 32.1504C38.0696 29.2886 33.0061 31.7848 33.0061 31.7848H33.0313C33.6485 31.873 35.1222 32.0243 35.0844 32.6799C35.0592 33.1085 33.1698 34.407 27.2372 33.928C25.373 35.5038 17.8407 38.8951 11.1775 37.7857C6.34069 36.6511 3.74595 34.407 2.39819 32.0874C3.63259 32.9572 8.80948 35.882 18.9869 32.6547C30.7262 28.9356 34.4672 26.8933 44.1912 29.4273C44.1912 29.4273 44.1912 29.4399 44.1912 29.4525C44.6194 30.4863 44.7328 31.1418 44.7328 31.1418C46.3577 32.1756 47.3401 34.5709 46.8741 35.0374V35.0248Z" fill="#B3DFFF"/>
+<path d="M42.0625 25.7965C43.1331 27.1832 43.7881 28.4565 44.1912 29.4273C34.4672 26.8933 30.7136 28.9356 18.9869 32.6546C8.82206 35.882 3.63257 32.9572 2.39818 32.0873C2.39818 32.0873 2.39818 32.0747 2.39818 32.0621C0.231694 28.3305 1.22677 24.3845 1.22677 24.3845C1.44089 24.1576 1.69281 23.918 1.96992 23.6659C3.07835 24.6744 8.53235 28.8852 19.138 26.2251C19.138 26.2251 35.7646 22.0144 42.0625 25.7713V25.7965Z" fill="#52A6FF"/>
+<path d="M36.5202 20.9302C39.0646 22.4556 40.8406 24.1954 42.075 25.7839C35.7771 22.0144 19.1505 26.2377 19.1505 26.2377C8.54485 28.8978 3.09086 24.6871 1.98242 23.6785C3.83401 22.027 7.10893 19.8712 11.5049 18.4592C12.3614 18.8753 15.46 20.1738 19.6922 19.5686C24.6423 18.8627 30.4868 18.7492 36.5076 20.9302H36.5202Z" fill="#0175EE"/>
+<path d="M34.1774 19.6947C35.0213 20.0855 35.8023 20.5016 36.5076 20.9302C30.4868 18.7492 24.6424 18.8627 19.6922 19.5687C15.46 20.1738 12.3488 18.8753 11.4923 18.4592C16.4425 16.8582 22.8412 16.19 30.2349 18.2323C31.6834 18.661 32.9934 19.1652 34.1648 19.7073L34.1774 19.6947Z" fill="#015BC7"/>
+<path d="M19.201 11.1977C19.201 11.6894 18.8987 12.118 18.4704 12.3071C17.4628 12.8114 16.644 13.6182 16.1528 14.6268C16.0772 14.2738 16.0394 13.9082 16.0394 13.5426C16.0394 12.4332 16.3921 11.412 16.9841 10.5799C17.0219 10.5169 17.0723 10.4539 17.1227 10.4034C17.3368 10.1639 17.6517 10.0126 18.0044 10.0126C18.672 10.0126 19.201 10.5421 19.201 11.2103V11.1977Z" fill="#015BC7"/>
+<path d="M15.0569 15.837C15.0569 16.0261 15.0569 16.2152 15.0317 16.3917C14.4523 15.7992 13.7344 15.358 12.9282 15.1058C12.9156 15.1058 12.8904 15.1058 12.8653 15.0932C12.3488 14.9293 11.9709 14.4503 11.9709 13.8703C11.9709 13.1644 12.5378 12.597 13.2431 12.597C13.7218 12.597 14.15 12.8744 14.3642 13.2652C14.805 14.0216 15.0569 14.9041 15.0569 15.8244V15.837Z" fill="#015BC7"/>
+<path d="M20.0701 33.5119C20.6753 33.5119 21.1659 33.0209 21.1659 32.4151C21.1659 31.8094 20.6753 31.3183 20.0701 31.3183C19.4649 31.3183 18.9742 31.8094 18.9742 32.4151C18.9742 33.0209 19.4649 33.5119 20.0701 33.5119Z" fill="#0175EE"/>
+</g>
+<defs>
+<clipPath id="clip0_9_11">
+<rect width="46" height="28" fill="white" transform="translate(1 10)"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index c0d76386eb..e3a84dfd4e 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -332,6 +332,7 @@ const driverProfiles: Record<
icon: "oceanbase",
},
goldendb: { type: "goldendb", port: 3306, user: "root", label: "GoldenDB", icon: "goldendb" },
+ databend: { type: "databend", port: 8000, user: "databend", label: "Databend", icon: "databend" },
tdsql: { type: "mysql", port: 3306, user: "root", label: "TDSQL", icon: "tdsql" },
polardb: { type: "mysql", port: 3306, user: "root", label: "PolarDB", icon: "polardb" },
greatsql: { type: "mysql", port: 3306, user: "root", label: "GreatSQL", icon: "greatsql" },
@@ -600,6 +601,7 @@ function defaultDatabaseForProfile() {
if (form.value.db_type === "redshift") return "dev";
if (form.value.db_type === "gaussdb") return "postgres";
if (form.value.db_type === "kwdb") return "defaultdb";
+ if (form.value.db_type === "databend") return "default";
if (selectedType.value === "cockroachdb") return "defaultdb";
if (form.value.db_type === "highgo") return "highgo";
if (form.value.db_type === "yashandb") return "yasdb";
@@ -636,6 +638,7 @@ const iconTypeMap: Record<string, string> = {
oceanbase: "oceanbase",
"oceanbase-oracle": "oceanbase",
goldendb: "goldendb",
+ databend: "databend",
tdsql: "tdsql",
polardb: "polardb",
greatsql: "greatsql",
@@ -699,6 +702,7 @@ const dbOptions = [
{ value: "tidb", label: "TiDB" },
{ value: "oceanbase", label: "OceanBase" },
{ value: "goldendb", label: "GoldenDB" },
+ { value: "databend", label: "Databend" },
{ value: "tdsql", label: "TDSQL" },
{ value: "polardb", label: "PolarDB" },
{ value: "greatsql", label: "GreatSQL" },
diff --git a/apps/desktop/src/components/icons/DatabaseIcon.vue b/apps/desktop/src/components/icons/DatabaseIcon.vue
index fbc90aaf9f..2a15e8d1a6 100644
--- a/apps/desktop/src/components/icons/DatabaseIcon.vue
+++ b/apps/desktop/src/components/icons/DatabaseIcon.vue
@@ -33,6 +33,7 @@ const assetIcons: Record<string, string> = {
kingbase: "kingbase",
highgo: "highgo.png",
goldendb: "goldendb.png",
+ databend: "databend",
vastbase: "vastbase.png",
yashandb: "yashandb.png",
snowflake: "snowflake",
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 4903f148fe..fd18588a2c 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -117,6 +117,7 @@ import { buildRoutineRenameObjectSourceStatements, supportsSourceBackedRoutineRe
import { buildViewDdl } from "@/lib/viewDdl";
import { getTableStructureCapabilities } from "@/lib/tableStructureCapabilities";
import {
+ connectionObjectTreeNodeSchema,
connectionObjectTreeQuerySchema,
connectionUsesDatabaseObjectTreeMode,
effectiveDatabaseTypeForConnection,
@@ -753,7 +754,7 @@ async function openData() {
table: node.label,
dbType: config?.db_type,
});
- const tableSchema = connectionUsesDatabaseObjectTreeMode(config) ? undefined : node.schema;
+ const tableSchema = connectionObjectTreeNodeSchema(config, node.database, node.schema);
const tabId = (() => {
if (settingsStore.editorSettings.reuseDataTab) {
const existing = queryStore.tabs.find(
diff --git a/apps/desktop/src/lib/databaseCapabilitySets.ts b/apps/desktop/src/lib/databaseCapabilitySets.ts
index 27f7de8c67..c0c7dcac19 100644
--- a/apps/desktop/src/lib/databaseCapabilitySets.ts
+++ b/apps/desktop/src/lib/databaseCapabilitySets.ts
@@ -25,6 +25,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"snowflake",
"trino",
"hive",
+ "databend",
"db2",
"tdengine",
"xugu",
@@ -242,6 +243,7 @@ export const AGENT_DRIVER_TYPES = new Set<DatabaseType>([
"vastbase",
"yashandb",
"goldendb",
+ "databend",
"databricks",
"saphana",
"teradata",
diff --git a/apps/desktop/src/lib/jdbcDialect.ts b/apps/desktop/src/lib/jdbcDialect.ts
index 05469848c4..4df3d4d3a6 100644
--- a/apps/desktop/src/lib/jdbcDialect.ts
+++ b/apps/desktop/src/lib/jdbcDialect.ts
@@ -2,6 +2,7 @@ import type { ConnectionConfig, DatabaseType } from "@/types/database";
import { isSchemaAware, usesDatabaseObjectTreeMode } from "@/lib/databaseFeatureSupport";
const JDBC_DIALECT_MATCHERS: Array<{ type: DatabaseType; patterns: RegExp[] }> = [
+ { type: "databend", patterns: [/jdbc:databend:/i, /com\.databend\.jdbc\.DatabendDriver/i, /databend-jdbc/i] },
{ type: "starrocks", patterns: [/starrocks/i] },
{ type: "doris", patterns: [/doris/i] },
{ type: "hive", patterns: [/org\.apache\.hive\.jdbc\.HiveDriver/i, /hive-jdbc/i] },
@@ -45,6 +46,12 @@ export function connectionUsesDatabaseObjectTreeMode(
return true;
}
+export function connectionUsesSchemaExecutionContext(
+ connection?: Pick<ConnectionConfig, "db_type" | "connection_string" | "jdbc_driver_class" | "jdbc_driver_paths">,
+): boolean {
+ return connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend";
+}
+
export function connectionObjectTreeQuerySchema(
connection:
| Pick<ConnectionConfig, "db_type" | "connection_string" | "jdbc_driver_class" | "jdbc_driver_paths">
@@ -52,6 +59,7 @@ export function connectionObjectTreeQuerySchema(
database: string,
schema?: string,
): string {
+ if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
if (connectionUsesDatabaseObjectTreeMode(connection)) return "";
return schema || database;
}
@@ -63,6 +71,7 @@ export function connectionObjectTreeNodeSchema(
database: string,
schema?: string,
): string | undefined {
+ if (connection?.db_type === "jdbc" && inferJdbcDialect(connection) === "databend") return schema || database;
if (connectionUsesDatabaseObjectTreeMode(connection)) return undefined;
if (schema) return schema;
const type = connection?.db_type === "jdbc" ? effectiveDatabaseTypeForConnection(connection) : connection?.db_type;
diff --git a/apps/desktop/src/lib/tableSelectSql.ts b/apps/desktop/src/lib/tableSelectSql.ts
index bed3ae0626..0e6500b380 100644
--- a/apps/desktop/src/lib/tableSelectSql.ts
+++ b/apps/desktop/src/lib/tableSelectSql.ts
@@ -19,7 +19,13 @@ export interface BuildTableSelectSqlOptions {
export function quoteTableIdentifier(databaseType: DatabaseType | undefined, name: string): string {
if (databaseType === "iotdb") return name;
if (databaseType === "jdbc") return quoteJdbcIdentifier(name);
- if (databaseType === "mysql" || databaseType === "hive" || databaseType === "tdengine" || databaseType === "access")
+ if (
+ databaseType === "mysql" ||
+ databaseType === "hive" ||
+ databaseType === "databend" ||
+ databaseType === "tdengine" ||
+ databaseType === "access"
+ )
return `\`${name.replace(/`/g, "``")}\``;
if (databaseType === "informix" && /^[A-Za-z_][A-Za-z0-9_$]*$/.test(name)) return name;
if (databaseType === "neo4j") return quoteCypherIdentifier(name);
diff --git a/apps/desktop/src/stores/queryStore.ts b/apps/desktop/src/stores/queryStore.ts
index 411433b4c2..dd0349d36e 100644
--- a/apps/desktop/src/stores/queryStore.ts
+++ b/apps/desktop/src/stores/queryStore.ts
@@ -30,7 +30,11 @@ import { editablePrimaryKeys } from "@/lib/tableEditing";
import { TABLE_DATA_EXPORT_PAGE_SIZE } from "@/lib/tableDataExport";
import { tableMetaForDataTab } from "@/lib/tableDataTabMeta";
import { quoteTableIdentifier } from "@/lib/tableSelectSql";
-import { connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/jdbcDialect";
+import {
+ connectionUsesDatabaseObjectTreeMode,
+ connectionUsesSchemaExecutionContext,
+ effectiveDatabaseTypeForConnection,
+} from "@/lib/jdbcDialect";
import { queryTimeoutSecsForConnection } from "@/lib/queryTimeout";
import { clearDataGridPendingSnapshotsForTab } from "@/composables/useDataGridEditor";
import {
@@ -1161,8 +1165,11 @@ export const useQueryStore = defineStore("query", () => {
...(clientSessionId ? { clientSessionId } : {}),
timeoutSecs: queryTimeoutSecs,
};
- const executionSchema =
- tab.mode === "data" || connectionUsesDatabaseObjectTreeMode(conn) ? undefined : tab.schema;
+ const executionSchema = connectionUsesSchemaExecutionContext(conn)
+ ? tab.schema || tab.database
+ : tab.mode === "data" || connectionUsesDatabaseObjectTreeMode(conn)
+ ? undefined
+ : tab.schema;
const executionPromise = api.executeMulti(
tab.connectionId,
tab.database,
diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts
index 962138f0ce..4ce933cee2 100644
--- a/apps/desktop/src/types/database.ts
+++ b/apps/desktop/src/types/database.ts
@@ -12,6 +12,7 @@ export type DatabaseType =
| "elasticsearch"
| "doris"
| "starrocks"
+ | "databend"
| "redshift"
| "dameng"
| "gaussdb"
diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.json
index ca14731c8c..3724014c6f 100644
--- a/crates/dbx-core/assets/database-drivers.manifest.json
+++ b/crates/dbx-core/assets/database-drivers.manifest.json
@@ -200,6 +200,17 @@
"skipTcpProbe": true,
"defaultPort": 3306
},
+ {
+ "dbType": "databend",
+ "label": "Databend",
+ "runtimeMode": "agent",
+ "mcpMode": "bridge",
+ "agentKey": "databend",
+ "singleConnectionPool": false,
+ "metadataConnectionScoped": false,
+ "skipTcpProbe": true,
+ "defaultPort": 8000
+ },
{
"dbType": "gaussdb",
"label": "GaussDB",
diff --git a/crates/dbx-core/src/agent_catalog.rs b/crates/dbx-core/src/agent_catalog.rs
index 8cc6b6b8a4..5764ac1890 100644
--- a/crates/dbx-core/src/agent_catalog.rs
+++ b/crates/dbx-core/src/agent_catalog.rs
@@ -61,6 +61,13 @@ const AGENT_CATALOG: &[AgentCatalogEntry] = &[
store_visible: true,
profiles: &[],
},
+ AgentCatalogEntry {
+ db_type: DatabaseType::Databend,
+ key: "databend",
+ label: "Databend",
+ store_visible: true,
+ profiles: &[],
+ },
AgentCatalogEntry {
db_type: DatabaseType::Databricks,
key: "databricks",
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index cf07a4de98..b34d7e06c7 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -321,7 +321,7 @@ impl AppState {
connect_mysql_metadata_pool(&config, &db_config, &host, port, connect_timeout).await?;
PoolKind::Mysql(pool, mode)
}
- DatabaseType::Doris | DatabaseType::StarRocks => {
+ DatabaseType::Doris | DatabaseType::StarRocks | DatabaseType::Databend => {
let pool = if database.is_none() {
connect_bare_metadata_pool(&db_config, &host, port, connect_timeout).await?
} else {
diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rs
index 20588c3601..6e69725345 100644
--- a/crates/dbx-core/src/models/connection.rs
+++ b/crates/dbx-core/src/models/connection.rs
@@ -214,6 +214,7 @@ pub enum DatabaseType {
Doris,
#[serde(rename = "starrocks")]
StarRocks,
+ Databend,
Redshift,
Dameng,
Kingbase,
@@ -606,7 +607,7 @@ impl ConnectionConfig {
let fragment = self.redis_tls_insecure_fragment();
format!("{scheme}://{host}:{port}/{fragment}")
}
- DatabaseType::Mysql | DatabaseType::Doris | DatabaseType::StarRocks => {
+ DatabaseType::Mysql | DatabaseType::Doris | DatabaseType::StarRocks | DatabaseType::Databend => {
let suffix = if params.is_empty() { String::new() } else { format!("?{params}") };
format!("mysql://{host}:{port}{db_part}{suffix}")
}
@@ -719,7 +720,7 @@ impl ConnectionConfig {
format!("{scheme}://{username}:{password}@{host}:{port}/{fragment}")
}
}
- DatabaseType::Mysql | DatabaseType::Doris | DatabaseType::StarRocks => {
+ DatabaseType::Mysql | DatabaseType::Doris | DatabaseType::StarRocks | DatabaseType::Databend => {
let suffix = if params.is_empty() { String::new() } else { format!("?{params}") };
format!("mysql://{}:{}@{host}:{port}{db_part}{suffix}", username, password)
}
@@ -886,7 +887,9 @@ impl ConnectionConfig {
}
match self.db_type {
DatabaseType::Mysql => normalize_mysql_url_params(value, self.ssl, self.ca_cert_path.trim().is_empty()),
- DatabaseType::Doris | DatabaseType::StarRocks => normalize_bare_mysql_url_params(value),
+ DatabaseType::Doris | DatabaseType::StarRocks | DatabaseType::Databend => {
+ normalize_bare_mysql_url_params(value)
+ }
DatabaseType::Postgres | DatabaseType::Redshift => normalize_postgres_url_params(value, self.ssl),
DatabaseType::MongoDb => value.trim_start_matches('?').to_string(),
_ => value.trim_start_matches('?').to_string(),
diff --git a/crates/dbx-core/src/sql_dialect.rs b/crates/dbx-core/src/sql_dialect.rs
index 747a0582a3..ca78360d54 100644
--- a/crates/dbx-core/src/sql_dialect.rs
+++ b/crates/dbx-core/src/sql_dialect.rs
@@ -213,6 +213,7 @@ pub fn quote_table_identifier(database_type: Option<DatabaseType>, name: &str) -
Some(
DatabaseType::Mysql
| DatabaseType::Hive
+ | DatabaseType::Databend
| DatabaseType::Tdengine
| DatabaseType::Access
| DatabaseType::Bigquery,
@@ -418,6 +419,7 @@ pub fn is_schema_aware(database_type: DatabaseType) -> bool {
| DatabaseType::OpenGauss
| DatabaseType::OceanbaseOracle
| DatabaseType::Gbase
+ | DatabaseType::Databend
| DatabaseType::Jdbc
| DatabaseType::H2
| DatabaseType::Snowflake
@@ -472,6 +474,7 @@ mod tests {
assert_eq!(qualified_table_name(Some(DatabaseType::Postgres), Some("public"), "users"), "\"public\".\"users\"");
assert_eq!(qualified_table_name(Some(DatabaseType::Kwdb), Some("public"), "users"), "\"public\".\"users\"");
assert_eq!(qualified_table_name(Some(DatabaseType::Mysql), Some("public"), "users"), "`users`");
+ assert_eq!(qualified_table_name(Some(DatabaseType::Databend), Some("dbx_test"), "users"), "`dbx_test`.`users`");
assert_eq!(qualified_table_name(Some(DatabaseType::Jdbc), Some("cbsdw_dwd"), "dwd_test_df"), "dwd_test_df");
assert_eq!(qualified_table_name(Some(DatabaseType::Iotdb), Some("root.test"), "device2"), "root.test.device2");
assert_eq!(
@@ -529,6 +532,17 @@ mod tests {
}),
"SELECT * FROM dwd_test_df LIMIT 100;"
);
+ assert_eq!(
+ build_table_select_sql(TableSelectSqlOptions {
+ database_type: Some(DatabaseType::Databend),
+ schema: Some("dbx_test"),
+ table_name: "jdbc_probe",
+ columns: &[],
+ order_columns: &[],
+ limit: 500,
+ }),
+ "SELECT * FROM `dbx_test`.`jdbc_probe` LIMIT 500;"
+ );
assert_eq!(
build_table_select_sql(TableSelectSqlOptions {
database_type: Some(DatabaseType::Hive),
diff --git a/crates/dbx-core/tests/database_capabilities.rs b/crates/dbx-core/tests/database_capabilities.rs
index 2d63f6509c..ecec3b9e44 100644
--- a/crates/dbx-core/tests/database_capabilities.rs
+++ b/crates/dbx-core/tests/database_capabilities.rs
@@ -62,6 +62,7 @@ fn maps_agent_database_types_to_driver_keys() {
assert_eq!(agent_key(&DatabaseType::Gbase, None), Some("gbase"));
assert_eq!(agent_key(&DatabaseType::Access, None), Some("access"));
assert_eq!(agent_key(&DatabaseType::Oracle, None), Some("oracle"));
+ assert_eq!(agent_key(&DatabaseType::Databend, None), Some("databend"));
assert_eq!(agent_key(&DatabaseType::Oracle, Some("oracle-legacy")), Some("oracle-legacy"));
assert_eq!(agent_key(&DatabaseType::Oracle, Some("oracle-10g")), Some("oracle-10g"));
assert_eq!(agent_key(&DatabaseType::Postgres, None), None);
@@ -84,6 +85,7 @@ fn classifies_agent_database_types() {
assert!(is_agent_type(&DatabaseType::OceanbaseOracle));
assert!(is_agent_type(&DatabaseType::Gbase));
assert!(is_agent_type(&DatabaseType::Access));
+ assert!(is_agent_type(&DatabaseType::Databend));
assert!(!is_agent_type(&DatabaseType::Mysql));
assert!(!is_agent_type(&DatabaseType::Jdbc));
assert!(!is_agent_type(&DatabaseType::Gaussdb));
@@ -132,6 +134,7 @@ fn skips_tcp_probe_for_local_file_plugin_and_agent_types() {
assert!(skips_tcp_probe(&DatabaseType::Databricks));
assert!(skips_tcp_probe(&DatabaseType::OceanbaseOracle));
assert!(skips_tcp_probe(&DatabaseType::Gbase));
+ assert!(skips_tcp_probe(&DatabaseType::Databend));
assert!(!skips_tcp_probe(&DatabaseType::Postgres));
assert!(!skips_tcp_probe(&DatabaseType::Mysql));
assert!(!skips_tcp_probe(&DatabaseType::Gaussdb));
diff --git a/packages/app-tests/jdbcDialect.test.ts b/packages/app-tests/jdbcDialect.test.ts
index 30ac25ba8f..b4c3e7d5e8 100644
--- a/packages/app-tests/jdbcDialect.test.ts
+++ b/packages/app-tests/jdbcDialect.test.ts
@@ -1,7 +1,9 @@
import assert from "node:assert/strict";
import test from "node:test";
import {
+ connectionObjectTreeNodeSchema,
connectionObjectTreeQuerySchema,
+ connectionUsesSchemaExecutionContext,
connectionUsesDatabaseObjectTreeMode,
effectiveDatabaseTypeForConnection,
inferJdbcDialect,
@@ -19,9 +21,10 @@ test("infers JDBC dialect from URL, driver class, and driver jar path", () => {
"mysql",
);
assert.equal(inferJdbcDialect({ db_type: "jdbc", jdbc_driver_class: "org.apache.hive.jdbc.HiveDriver" }), "hive");
+ assert.equal(inferJdbcDialect({ db_type: "jdbc", jdbc_driver_paths: ["/drivers/starrocks-jdbc.jar"] }), "starrocks");
assert.equal(
- inferJdbcDialect({ db_type: "jdbc", jdbc_driver_paths: ["/drivers/starrocks-jdbc.jar"] }),
- "starrocks",
+ inferJdbcDialect({ db_type: "jdbc", connection_string: "jdbc:databend://db.example.com:8000/default" }),
+ "databend",
);
});
@@ -29,12 +32,18 @@ test("effective database type keeps non-JDBC types and enables compatible JDBC s
assert.equal(effectiveDatabaseTypeForConnection({ db_type: "postgres" }), "postgres");
assert.equal(effectiveDatabaseTypeForConnection({ db_type: "jdbc" }), "jdbc");
assert.equal(
- effectiveDatabaseTypeForConnection({ db_type: "jdbc", jdbc_driver_class: "org.apache.kyuubi.jdbc.KyuubiHiveDriver" }),
+ effectiveDatabaseTypeForConnection({
+ db_type: "jdbc",
+ jdbc_driver_class: "org.apache.kyuubi.jdbc.KyuubiHiveDriver",
+ }),
"mysql",
);
assert.equal(
supportsTableStructureEditing(
- effectiveDatabaseTypeForConnection({ db_type: "jdbc", jdbc_driver_class: "org.apache.kyuubi.jdbc.KyuubiHiveDriver" }),
+ effectiveDatabaseTypeForConnection({
+ db_type: "jdbc",
+ jdbc_driver_class: "org.apache.kyuubi.jdbc.KyuubiHiveDriver",
+ }),
),
true,
);
@@ -58,3 +67,21 @@ test("JDBC tree shape follows the inferred driver dialect", () => {
"`test`.`dws_event_analyse`",
);
});
+
+test("Databend JDBC keeps database as schema context for table data", () => {
+ const databend = { db_type: "jdbc" as const, connection_string: "jdbc:databend://db.example.com:8000/dbx_test" };
+
+ assert.equal(effectiveDatabaseTypeForConnection(databend), "databend");
+ assert.equal(connectionUsesDatabaseObjectTreeMode(databend), true);
+ assert.equal(connectionUsesSchemaExecutionContext(databend), true);
+ assert.equal(connectionObjectTreeQuerySchema(databend, "dbx_test", undefined), "dbx_test");
+ assert.equal(connectionObjectTreeNodeSchema(databend, "dbx_test", undefined), "dbx_test");
+ assert.equal(
+ qualifiedTableName({
+ databaseType: effectiveDatabaseTypeForConnection(databend),
+ schema: connectionObjectTreeNodeSchema(databend, "dbx_test", undefined),
+ tableName: "jdbc_probe",
+ }),
+ "`dbx_test`.`jdbc_probe`",
+ );
+});
diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts
index 91d17ec2d4..51559b19d8 100644
--- a/packages/mcp-server/src/index.ts
+++ b/packages/mcp-server/src/index.ts
@@ -46,7 +46,7 @@ function formatQueryToolResult(result: QueryResult, title?: string) {
}
export const DBX_CONNECTION_TYPE_DESCRIPTION =
- "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
+ "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
export function createDbxMcpServer(backend: Backend, options: { isWebMode?: boolean } = {}): McpServer {
const isWebMode = options.isWebMode ?? !!process.env.DBX_WEB_URL;
diff --git a/packages/node-core/src/diagnostics.ts b/packages/node-core/src/diagnostics.ts
index dfbbe33af5..6bd4707a18 100644
--- a/packages/node-core/src/diagnostics.ts
+++ b/packages/node-core/src/diagnostics.ts
@@ -36,6 +36,7 @@ export const BRIDGE_REQUIRED_TYPES = [
"highgo",
"vastbase",
"goldendb",
+ "databend",
"yashandb",
"databricks",
"saphana",