feat(database): add agent database profiles

This commit is contained in:
t8y2
2026-05-18 22:38:04 +08:00
parent b424816f74
commit b16393f68c
21 changed files with 277 additions and 5 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@@ -152,9 +152,26 @@ const driverProfiles: Record<
mariadb: { type: "mysql", port: 3306, user: "root", label: "MariaDB", icon: "mariadb" },
tidb: { type: "mysql", port: 4000, user: "root", label: "TiDB", icon: "tidb" },
oceanbase: { type: "mysql", port: 2881, user: "root", label: "OceanBase", icon: "oceanbase" },
"oceanbase-oracle": {
type: "oceanbase-oracle",
port: 2881,
user: "SYS",
label: "OceanBase Oracle Mode",
icon: "oceanbase",
},
goldendb: { type: "goldendb", port: 3306, user: "root", label: "GoldenDB", icon: "goldendb" },
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" },
databricks: { type: "databricks", port: 443, user: "token", label: "Databricks SQL", icon: "databricks" },
saphana: { type: "saphana", port: 30015, user: "SYSTEM", label: "SAP HANA", icon: "saphana" },
teradata: { type: "teradata", port: 1025, user: "", label: "Teradata", icon: "teradata" },
vertica: { type: "vertica", port: 5433, user: "dbadmin", label: "Vertica", icon: "vertica" },
firebird: { type: "firebird", port: 3050, user: "SYSDBA", label: "Firebird", icon: "firebird" },
exasol: { type: "exasol", port: 8563, user: "sys", label: "Exasol", icon: "exasol" },
gbase: { type: "gbase", port: 5258, user: "gbasedbt", label: "GBase", icon: "gbase" },
opengauss: {
type: "gaussdb",
type: "opengauss",
port: 5432,
user: "gaussdb",
label: "openGauss",
@@ -374,7 +391,18 @@ const iconTypeMap: Record<string, string> = {
mariadb: "mariadb",
tidb: "tidb",
oceanbase: "oceanbase",
"oceanbase-oracle": "oceanbase",
goldendb: "goldendb",
tdsql: "tdsql",
polardb: "polardb",
greatsql: "greatsql",
databricks: "databricks",
saphana: "saphana",
teradata: "teradata",
vertica: "vertica",
firebird: "firebird",
exasol: "exasol",
gbase: "gbase",
opengauss: "opengauss",
gaussdb: "gaussdb",
kingbase: "kingbase",
@@ -421,11 +449,22 @@ const dbOptions = [
{ value: "gaussdb", label: "GaussDB" },
{ value: "tidb", label: "TiDB" },
{ value: "oceanbase", label: "OceanBase" },
{ value: "oceanbase-oracle", label: "OceanBase Oracle Mode" },
{ value: "goldendb", label: "GoldenDB" },
{ value: "tdsql", label: "TDSQL" },
{ value: "polardb", label: "PolarDB" },
{ value: "greatsql", label: "GreatSQL" },
{ value: "doris", label: "Doris" },
{ value: "selectdb", label: "SelectDB" },
{ value: "starrocks", label: "StarRocks" },
{ value: "tdengine", label: "TDengine" },
{ value: "databricks", label: "Databricks SQL" },
{ value: "saphana", label: "SAP HANA" },
{ value: "teradata", label: "Teradata" },
{ value: "vertica", label: "Vertica" },
{ value: "firebird", label: "Firebird" },
{ value: "exasol", label: "Exasol" },
{ value: "gbase", label: "GBase" },
{ value: "opengauss", label: "openGauss" },
{ value: "kingbase", label: "KingBase" },
{ value: "highgo", label: "瀚高 HighGo" },
@@ -52,6 +52,16 @@ const assetIcons: Record<string, string> = {
redshift: "redshift",
neo4j: "neo4j",
informix: "informix",
databricks: "databricks.webp",
saphana: "saphana.webp",
teradata: "teradata.webp",
vertica: "vertica.webp",
firebird: "firebird.webp",
exasol: "exasol.webp",
gbase: "gbase.webp",
tdsql: "tdsql.webp",
polardb: "polardb.webp",
greatsql: "greatsql.webp",
};
const letterIcons: Record<string, { letter: string; color: string }> = {};
+59 -2
View File
@@ -11,6 +11,14 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"highgo",
"vastbase",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"jdbc",
"h2",
"snowflake",
@@ -35,6 +43,15 @@ export const DIAGRAM_SUPPORTED_TYPES = new Set<DatabaseType>([
"vastbase",
"goldendb",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"access",
"h2",
"db2",
@@ -56,6 +73,15 @@ export const DATABASE_SEARCH_SUPPORTED_TYPES = new Set<DatabaseType>([
"vastbase",
"goldendb",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"access",
"h2",
"snowflake",
@@ -110,6 +136,8 @@ export const CREATE_DATABASE_SUPPORTED_TYPES = new Set<DatabaseType>([
"oracle",
"dameng",
"gaussdb",
"opengauss",
"oceanbase-oracle",
"doris",
"starrocks",
"redshift",
@@ -124,9 +152,17 @@ export const FIELD_LINEAGE_SUPPORTED_TYPES = new Set<DatabaseType>([
"redshift",
"dameng",
"gaussdb",
"opengauss",
"oceanbase-oracle",
]);
export const SINGLE_DATABASE_TYPES = new Set<DatabaseType>(["oracle", "dameng", "access"]);
export const SINGLE_DATABASE_TYPES = new Set<DatabaseType>([
"oracle",
"dameng",
"firebird",
"oceanbase-oracle",
"access",
]);
export const FETCH_FIRST_TYPES = new Set<DatabaseType>(["oracle", "dameng"]);
@@ -139,13 +175,21 @@ export const TREE_SCHEMA_TYPES = new Set<DatabaseType>([
"highgo",
"vastbase",
"yashandb",
"databricks",
"saphana",
"teradata",
"vertica",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"jdbc",
"trino",
"h2",
"tdengine",
]);
export const PG_LIKE_STRUCTURE_TYPES = new Set<DatabaseType>(["postgres", "redshift", "gaussdb"]);
export const PG_LIKE_STRUCTURE_TYPES = new Set<DatabaseType>(["postgres", "redshift", "gaussdb", "opengauss"]);
export const AGENT_DRIVER_TYPES = new Set<DatabaseType>([
"dameng",
@@ -154,6 +198,15 @@ export const AGENT_DRIVER_TYPES = new Set<DatabaseType>([
"vastbase",
"yashandb",
"goldendb",
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
"access",
"oracle",
"h2",
@@ -181,6 +234,8 @@ export const TRANSFER_SQL_TYPES = new Set<DatabaseType>([
"duckdb",
"dameng",
"gaussdb",
"opengauss",
"oceanbase-oracle",
]);
export const DIAGRAM_SQL_TYPES = new Set<DatabaseType>([
@@ -192,4 +247,6 @@ export const DIAGRAM_SQL_TYPES = new Set<DatabaseType>([
"redshift",
"dameng",
"gaussdb",
"opengauss",
"oceanbase-oracle",
]);
+9
View File
@@ -19,6 +19,15 @@ export type DatabaseType =
| "vastbase"
| "goldendb"
| "yashandb"
| "databricks"
| "saphana"
| "teradata"
| "vertica"
| "firebird"
| "exasol"
| "opengauss"
| "oceanbase-oracle"
| "gbase"
| "access"
| "h2"
| "snowflake"
+9
View File
@@ -14,6 +14,15 @@ pub const AGENT_TYPES: &[(&str, &str)] = &[
("highgo", "瀚高 HighGo"),
("vastbase", "Vastbase"),
("goldendb", "GoldenDB"),
("databricks", "Databricks SQL"),
("saphana", "SAP HANA"),
("teradata", "Teradata"),
("vertica", "Vertica"),
("firebird", "Firebird"),
("exasol", "Exasol"),
("opengauss", "openGauss"),
("oceanbase-oracle", "OceanBase Oracle Mode"),
("gbase", "GBase"),
("access", "Microsoft Access"),
("oracle", "Oracle"),
("oracle-10g", "Oracle 10g"),
+10 -1
View File
@@ -71,7 +71,7 @@ pub fn metadata_connection_config(config: &ConnectionConfig) -> ConnectionConfig
pub fn database_connection_config(config: &ConnectionConfig, database: Option<&str>) -> ConnectionConfig {
let mut db_config = if database.is_some() { config.clone() } else { metadata_connection_config(config) };
if let Some(db) = database {
if !matches!(db_config.db_type, DatabaseType::Oracle | DatabaseType::Dameng) {
if !matches!(db_config.db_type, DatabaseType::Oracle | DatabaseType::Dameng | DatabaseType::OceanbaseOracle) {
db_config.database = Some(db.to_string());
}
}
@@ -233,6 +233,15 @@ impl AppState {
| DatabaseType::Vastbase
| DatabaseType::Goldendb
| DatabaseType::Yashandb
| DatabaseType::Databricks
| DatabaseType::SapHana
| DatabaseType::Teradata
| DatabaseType::Vertica
| DatabaseType::Firebird
| DatabaseType::Exasol
| DatabaseType::OpenGauss
| DatabaseType::OceanbaseOracle
| DatabaseType::Gbase
| DatabaseType::Oracle
| DatabaseType::H2
| DatabaseType::Snowflake
@@ -8,6 +8,15 @@ pub fn agent_key(db_type: &DatabaseType, driver_profile: Option<&str>) -> Option
DatabaseType::Vastbase => Some("vastbase"),
DatabaseType::Goldendb => Some("goldendb"),
DatabaseType::Yashandb => Some("yashandb"),
DatabaseType::Databricks => Some("databricks"),
DatabaseType::SapHana => Some("saphana"),
DatabaseType::Teradata => Some("teradata"),
DatabaseType::Vertica => Some("vertica"),
DatabaseType::Firebird => Some("firebird"),
DatabaseType::Exasol => Some("exasol"),
DatabaseType::OpenGauss => Some("opengauss"),
DatabaseType::OceanbaseOracle => Some("oceanbase-oracle"),
DatabaseType::Gbase => Some("gbase"),
DatabaseType::Oracle => match driver_profile {
Some("oracle-10g") => Some("oracle-10g"),
_ => Some("oracle"),
@@ -47,6 +56,8 @@ pub fn is_single_connection_pool(db_type: &DatabaseType) -> bool {
| DatabaseType::Vastbase
| DatabaseType::Goldendb
| DatabaseType::Yashandb
| DatabaseType::Firebird
| DatabaseType::OceanbaseOracle
| DatabaseType::Access
| DatabaseType::Jdbc
)
+50 -1
View File
@@ -131,6 +131,18 @@ pub enum DatabaseType {
Goldendb,
Gaussdb,
Yashandb,
Databricks,
#[serde(rename = "saphana")]
SapHana,
Teradata,
Vertica,
Firebird,
Exasol,
#[serde(rename = "opengauss")]
OpenGauss,
#[serde(rename = "oceanbase-oracle")]
OceanbaseOracle,
Gbase,
Access,
#[serde(rename = "h2")]
H2,
@@ -175,10 +187,11 @@ impl ConnectionConfig {
_ => Some("postgres"),
},
DatabaseType::Redshift => Some("dev"),
DatabaseType::Gaussdb => Some("postgres"),
DatabaseType::Gaussdb | DatabaseType::OpenGauss => Some("postgres"),
DatabaseType::Kingbase | DatabaseType::Vastbase => Some("postgres"),
DatabaseType::Highgo => Some("highgo"),
DatabaseType::Yashandb => Some("yasdb"),
DatabaseType::Firebird => Some("employee"),
_ => None,
}
}
@@ -272,6 +285,15 @@ impl ConnectionConfig {
DatabaseType::Goldendb => format!("goldendb://{host}:{port}{db_part}"),
DatabaseType::Gaussdb => format!("gaussdb://{host}:{port}{db_part}"),
DatabaseType::Yashandb => format!("yashandb://{host}:{port}{db_part}"),
DatabaseType::Databricks => format!("databricks://{host}:{port}{db_part}"),
DatabaseType::SapHana => format!("saphana://{host}:{port}{db_part}"),
DatabaseType::Teradata => format!("teradata://{host}:{port}{db_part}"),
DatabaseType::Vertica => format!("vertica://{host}:{port}{db_part}"),
DatabaseType::Firebird => format!("firebird://{host}:{port}{db_part}"),
DatabaseType::Exasol => format!("exasol://{host}:{port}{db_part}"),
DatabaseType::OpenGauss => format!("opengauss://{host}:{port}{db_part}"),
DatabaseType::OceanbaseOracle => format!("oceanbase-oracle://{host}:{port}{db_part}"),
DatabaseType::Gbase => format!("gbase://{host}:{port}{db_part}"),
DatabaseType::H2 => format!("h2://{host}:{port}{db_part}"),
DatabaseType::Snowflake => format!("snowflake://{host}/{db_part}"),
DatabaseType::Trino => format!("trino://{host}:{port}{db_part}"),
@@ -374,6 +396,33 @@ impl ConnectionConfig {
DatabaseType::Yashandb => {
format!("yashandb://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Databricks => {
format!("databricks://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::SapHana => {
format!("saphana://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Teradata => {
format!("teradata://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Vertica => {
format!("vertica://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Firebird => {
format!("firebird://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Exasol => {
format!("exasol://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::OpenGauss => {
format!("opengauss://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::OceanbaseOracle => {
format!("oceanbase-oracle://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::Gbase => {
format!("gbase://{}:{}@{host}:{port}{db_part}", username, password)
}
DatabaseType::H2 => {
format!("h2://{}:{}@{host}:{port}{db_part}", username, password)
}
@@ -10,6 +10,15 @@ fn maps_agent_database_types_to_driver_keys() {
assert_eq!(agent_key(&DatabaseType::Gaussdb, None), Some("gaussdb"));
assert_eq!(agent_key(&DatabaseType::Tdengine, None), Some("tdengine"));
assert_eq!(agent_key(&DatabaseType::Yashandb, None), Some("yashandb"));
assert_eq!(agent_key(&DatabaseType::Databricks, None), Some("databricks"));
assert_eq!(agent_key(&DatabaseType::SapHana, None), Some("saphana"));
assert_eq!(agent_key(&DatabaseType::Teradata, None), Some("teradata"));
assert_eq!(agent_key(&DatabaseType::Vertica, None), Some("vertica"));
assert_eq!(agent_key(&DatabaseType::Firebird, None), Some("firebird"));
assert_eq!(agent_key(&DatabaseType::Exasol, None), Some("exasol"));
assert_eq!(agent_key(&DatabaseType::OpenGauss, None), Some("opengauss"));
assert_eq!(agent_key(&DatabaseType::OceanbaseOracle, None), Some("oceanbase-oracle"));
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::Oracle, Some("oracle-10g")), Some("oracle-10g"));
@@ -23,6 +32,15 @@ fn classifies_agent_database_types() {
assert!(is_agent_type(&DatabaseType::Hive));
assert!(is_agent_type(&DatabaseType::Tdengine));
assert!(is_agent_type(&DatabaseType::Yashandb));
assert!(is_agent_type(&DatabaseType::Databricks));
assert!(is_agent_type(&DatabaseType::SapHana));
assert!(is_agent_type(&DatabaseType::Teradata));
assert!(is_agent_type(&DatabaseType::Vertica));
assert!(is_agent_type(&DatabaseType::Firebird));
assert!(is_agent_type(&DatabaseType::Exasol));
assert!(is_agent_type(&DatabaseType::OpenGauss));
assert!(is_agent_type(&DatabaseType::OceanbaseOracle));
assert!(is_agent_type(&DatabaseType::Gbase));
assert!(is_agent_type(&DatabaseType::Access));
assert!(!is_agent_type(&DatabaseType::Mysql));
assert!(!is_agent_type(&DatabaseType::Jdbc));
@@ -36,6 +54,8 @@ fn identifies_single_connection_pool_types() {
assert!(is_single_connection_pool(&DatabaseType::Dameng));
assert!(is_single_connection_pool(&DatabaseType::Access));
assert!(is_single_connection_pool(&DatabaseType::Yashandb));
assert!(is_single_connection_pool(&DatabaseType::Firebird));
assert!(is_single_connection_pool(&DatabaseType::OceanbaseOracle));
assert!(is_single_connection_pool(&DatabaseType::Jdbc));
assert!(!is_single_connection_pool(&DatabaseType::Trino));
assert!(!is_single_connection_pool(&DatabaseType::Postgres));
@@ -60,6 +80,9 @@ fn skips_tcp_probe_for_local_file_plugin_and_agent_types() {
assert!(skips_tcp_probe(&DatabaseType::Oracle));
assert!(skips_tcp_probe(&DatabaseType::Tdengine));
assert!(skips_tcp_probe(&DatabaseType::Yashandb));
assert!(skips_tcp_probe(&DatabaseType::Databricks));
assert!(skips_tcp_probe(&DatabaseType::OceanbaseOracle));
assert!(skips_tcp_probe(&DatabaseType::Gbase));
assert!(!skips_tcp_probe(&DatabaseType::Postgres));
assert!(!skips_tcp_probe(&DatabaseType::Mysql));
}
@@ -37,6 +37,28 @@ test("treats Access as a local single-database agent driver", () => {
assert.equal(supportsTableImport("access"), true);
});
test("exposes the extended JDBC agent ecosystem through driver management", () => {
for (const dbType of [
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"opengauss",
"oceanbase-oracle",
"gbase",
] as const) {
assert.equal(supportsDriverManagement(dbType), true, `${dbType} should be agent-managed`);
assert.equal(supportsDatabaseSearch(dbType), true, `${dbType} should support database search`);
}
assert.equal(SCHEMA_AWARE_TYPES.has("databricks"), true);
assert.equal(SCHEMA_AWARE_TYPES.has("opengauss"), true);
assert.equal(SCHEMA_AWARE_TYPES.has("oceanbase-oracle"), true);
assert.equal(SCHEMA_AWARE_TYPES.has("firebird"), false);
});
test("describes schema tree mode through the capability helper", () => {
assert.equal(usesTreeSchemaMode("trino"), true);
assert.equal(usesTreeSchemaMode("h2"), true);
@@ -0,0 +1,34 @@
import { existsSync, readFileSync } from "node:fs";
import { join } from "node:path";
import assert from "node:assert/strict";
import test from "node:test";
const connectionDialogSource = readFileSync("apps/desktop/src/components/connection/ConnectionDialog.vue", "utf8");
const databaseIconSource = readFileSync("apps/desktop/src/components/icons/DatabaseIcon.vue", "utf8");
const expectedIconNames = [
"databricks",
"saphana",
"teradata",
"vertica",
"firebird",
"exasol",
"gbase",
"tdsql",
"polardb",
"greatsql",
] as const;
test("new database profiles use dedicated icon identities", () => {
for (const iconName of expectedIconNames) {
assert.match(connectionDialogSource, new RegExp(`${iconName}: \\{[^}]*icon: "${iconName}"`, "s"));
assert.match(databaseIconSource, new RegExp(`${iconName}: "${iconName}\\.webp"`));
}
});
test("new database favicon assets exist", () => {
for (const iconName of expectedIconNames) {
const iconPath = join("apps/desktop/public/icons/database", `${iconName}.webp`);
assert.equal(existsSync(iconPath), true, `${iconPath} should exist`);
}
});