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(spark): add Apache Spark database driver with catalog support

jischengc3893bf31461
diff --git a/agents/drivers/spark/build.gradle b/agents/drivers/spark/build.gradle
new file mode 100644
index 0000000000..868be72134
--- /dev/null
+++ b/agents/drivers/spark/build.gradle
@@ -0,0 +1,11 @@
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'org.apache.hive:hive-jdbc:4.0.1:standalone'
+ implementation 'org.slf4j:slf4j-nop:1.7.30'
+}
+
+tasks.named('shadowJar') {
+ manifest {
+ attributes('Agent-Label': 'Apache Spark', 'Main-Class': 'com.dbx.agent.spark.SparkAgent')
+ }
+}
diff --git a/agents/drivers/spark/src/main/java/com/dbx/agent/spark/SparkAgent.java b/agents/drivers/spark/src/main/java/com/dbx/agent/spark/SparkAgent.java
new file mode 100644
index 0000000000..fc0d4e9a0b
--- /dev/null
+++ b/agents/drivers/spark/src/main/java/com/dbx/agent/spark/SparkAgent.java
@@ -0,0 +1,308 @@
+package com.dbx.agent.spark;
+
+import com.dbx.agent.AbstractJdbcAgent;
+import com.dbx.agent.ColumnInfo;
+import com.dbx.agent.ConnectParams;
+import com.dbx.agent.DatabaseInfo;
+import com.dbx.agent.ForeignKeyInfo;
+import com.dbx.agent.IndexInfo;
+import com.dbx.agent.JdbcIdentifiers;
+import com.dbx.agent.JsonRpcServer;
+import com.dbx.agent.TableInfo;
+import com.dbx.agent.TriggerInfo;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+
+// Spark Thrift Server speaks the HiveServer2 protocol, so the Spark agent reuses
+// the Hive JDBC driver and mirrors the Hive agent's metadata queries (SHOW
+// DATABASES / SHOW TABLES / DESCRIBE), which Spark SQL supports as well.
+//
+// Spark 3.4+ supports multiple catalogs (Paimon, Lance, Iceberg, ...). When the
+// user supplies `catalog=<name>` in url_params, the agent switches to that catalog
+// after connecting and uses `SHOW TABLES IN <catalog>` for listing — which works
+// uniformly for catalogs that have databases (Paimon) and those that expose tables
+// at the catalog root with no databases (Lance). Mirrors the StarRocks catalog flow.
+public final class SparkAgent extends AbstractJdbcAgent {
+ private String configuredCatalog;
+
+ @Override
+ protected String driverClass() {
+ return "org.apache.hive.jdbc.HiveDriver";
+ }
+
+ @Override
+ protected String buildJdbcUrl(ConnectParams params) {
+ return "jdbc:hive2://" + params.getHost() + ":" + params.getPort() + "/";
+ }
+
+ @Override
+ protected void afterConnect(ConnectParams params, Connection connection) throws Exception {
+ String catalog = extractCatalogParam(params.getUrl_params());
+ configuredCatalog = catalog;
+ if (catalog != null && !catalog.isEmpty()) {
+ try (java.sql.Statement stmt = connection.createStatement()) {
+ stmt.execute("USE " + JdbcIdentifiers.INSTANCE.backtick(catalog));
+ }
+ }
+ }
+
+ @Override
+ public List<DatabaseInfo> listDatabases() {
+ return unchecked(() -> {
+ List<DatabaseInfo> result = new ArrayList<>();
+ try (java.sql.Statement stmt = requireConnected().createStatement();
+ ResultSet rs = stmt.executeQuery("SHOW DATABASES")) {
+ while (rs.next()) {
+ result.add(new DatabaseInfo(rs.getString(1)));
+ }
+ }
+ // Catalogs like Lance expose tables at the catalog root with no
+ // databases — SHOW DATABASES returns nothing. Return the catalog
+ // name itself as the database node so the sidebar can drill in.
+ if (result.isEmpty() && configuredCatalog != null && !configuredCatalog.isEmpty()) {
+ result.add(new DatabaseInfo(configuredCatalog));
+ }
+ result.sort(Comparator.comparing(DatabaseInfo::getName));
+ return result;
+ });
+ }
+
+ @Override
+ public List<String> listSchemas() {
+ List<String> result = new ArrayList<>();
+ for (DatabaseInfo database : listDatabases()) {
+ result.add(database.getName());
+ }
+ return result;
+ }
+
+ @Override
+ public List<TableInfo> listTables(String schema) {
+ return unchecked(() -> {
+ List<TableInfo> result = new ArrayList<>();
+ String sql = buildShowTablesSql(schema);
+ try (java.sql.Statement stmt = requireConnected().createStatement();
+ ResultSet rs = stmt.executeQuery(sql)) {
+ while (rs.next()) {
+ String name = readTableName(rs);
+ if (name != null && !name.isEmpty()) {
+ result.add(new TableInfo(name, "TABLE", null));
+ }
+ }
+ }
+ result.sort(Comparator.comparing(TableInfo::getName));
+ return result;
+ });
+ }
+
+ // With a catalog configured, use `SHOW TABLES IN <catalog>[.<schema>]` which
+ // works for both catalog-root tables (Lance) and catalog.schema tables (Paimon).
+ // Without a catalog, fall back to the Hive-style `USE <schema>` + SHOW TABLES.
+ private String buildShowTablesSql(String schema) throws Exception {
+ if (configuredCatalog != null && !configuredCatalog.isEmpty()) {
+ String target = JdbcIdentifiers.INSTANCE.backtick(configuredCatalog);
+ if (schema != null && !schema.isEmpty() && !schema.equals(configuredCatalog)) {
+ target += "." + JdbcIdentifiers.INSTANCE.backtick(schema);
+ }
+ return "SHOW TABLES IN " + target;
+ }
+ useSchema(schema);
+ return "SHOW TABLES";
+ }
+
+ // `SHOW TABLES` (Hive style) returns a single tabName column, while
+ // `SHOW TABLES IN <catalog>` (Spark SQL) returns (database, tableName,
+ // isTemporary). Pick tableName from whichever column it lives in.
+ private static String readTableName(ResultSet rs) throws Exception {
+ int columns = rs.getMetaData().getColumnCount();
+ return columns > 1 ? rs.getString(2) : rs.getString(1);
+ }
+
+ @Override
+ public List<ColumnInfo> getColumns(String schema, String table) {
+ return unchecked(() -> {
+ try {
+ return getColumnsFromDescribe(schema, table);
+ } catch (Exception ignored) {
+ return getColumnsFromMetadata(requireConnected(), schema, table);
+ }
+ });
+ }
+
+ @Override
+ public List<IndexInfo> listIndexes(String schema, String table) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<ForeignKeyInfo> listForeignKeys(String schema, String table) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List<TriggerInfo> listTriggers(String schema, String table) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String setSchemaSQL(String schema) {
+ // When a catalog is configured, qualify the USE statement with the
+ // catalog so switching schemas does not reset the catalog back to the
+ // default (spark_catalog).
+ if (configuredCatalog != null && !configuredCatalog.isEmpty()) {
+ if (schema == null || schema.isEmpty() || schema.equals(configuredCatalog)) {
+ return "USE " + JdbcIdentifiers.INSTANCE.backtick(configuredCatalog);
+ }
+ return "USE " + JdbcIdentifiers.INSTANCE.backtick(configuredCatalog)
+ + "." + JdbcIdentifiers.INSTANCE.backtick(schema);
+ }
+ return "USE " + JdbcIdentifiers.INSTANCE.backtick(schema);
+ }
+
+ private static String extractCatalogParam(String urlParams) {
+ if (urlParams == null || urlParams.isEmpty()) {
+ return null;
+ }
+ for (String segment : urlParams.split("&")) {
+ int eq = segment.indexOf('=');
+ if (eq <= 0) {
+ continue;
+ }
+ if (segment.substring(0, eq).trim().equalsIgnoreCase("catalog")) {
+ String value = segment.substring(eq + 1).trim();
+ return value.isEmpty() ? null : value;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected Object resultValue(ResultSet rs, int index, int sqlType) {
+ return unchecked(() -> {
+ Object value = rs.getObject(index);
+ return rs.wasNull() ? null : value == null ? null : value.toString();
+ });
+ }
+
+ private void useSchema(String schema) throws Exception {
+ try (java.sql.Statement stmt = requireConnected().createStatement()) {
+ stmt.execute(setSchemaSQL(schema));
+ }
+ }
+
+ private List<ColumnInfo> getColumnsFromDescribe(String schema, String table) throws Exception {
+ List<ColumnInfo> result = new ArrayList<>();
+ // Use catalog-qualified DESCRIBE when a catalog is configured, avoiding
+ // USE <schema> which would generate USE `catalog`.`catalog` when the
+ // sidebar passes the catalog name as the schema (Lance case).
+ String describeTarget;
+ if (configuredCatalog != null && !configuredCatalog.isEmpty()) {
+ describeTarget = JdbcIdentifiers.INSTANCE.backtick(configuredCatalog);
+ if (schema != null && !schema.isEmpty() && !schema.equals(configuredCatalog)) {
+ describeTarget += "." + JdbcIdentifiers.INSTANCE.backtick(schema);
+ }
+ describeTarget += "." + JdbcIdentifiers.INSTANCE.backtick(table);
+ } else {
+ useSchema(schema);
+ describeTarget = JdbcIdentifiers.INSTANCE.backtick(table);
+ }
+ try (java.sql.Statement stmt = requireConnected().createStatement();
+ ResultSet rs = stmt.executeQuery("DESCRIBE " + describeTarget)) {
+ while (rs.next()) {
+ String colName = trimToNull(rs.getString(1));
+ if (colName == null || colName.startsWith("#")) {
+ continue;
+ }
+ result.add(new ColumnInfo(
+ colName,
+ trimToEmpty(rs.getString(2)),
+ true,
+ null,
+ false,
+ null,
+ optionalComment(rs),
+ null,
+ null,
+ null
+ ));
+ }
+ }
+ return result;
+ }
+
+ private static List<ColumnInfo> getColumnsFromMetadata(Connection conn, String schema, String table) throws Exception {
+ List<ColumnInfo> result = new ArrayList<>();
+ DatabaseMetaData meta = conn.getMetaData();
+ try (ResultSet rs = meta.getColumns(null, trimToNull(schema), table, "%")) {
+ while (rs.next()) {
+ String name = rs.getString("COLUMN_NAME");
+ if (trimToNull(name) == null) {
+ continue;
+ }
+ result.add(new ColumnInfo(
+ name,
+ trimToEmpty(rs.getString("TYPE_NAME")),
+ rs.getInt("NULLABLE") != DatabaseMetaData.columnNoNulls,
+ rs.getString("COLUMN_DEF"),
+ false,
+ null,
+ rs.getString("REMARKS"),
+ intOrNull(rs, "COLUMN_SIZE"),
+ intOrNull(rs, "DECIMAL_DIGITS"),
+ characterLength(rs)
+ ));
+ }
+ }
+ return result;
+ }
+
+ private static String trimToNull(String value) {
+ if (value == null) {
+ return null;
+ }
+ String trimmed = value.trim();
+ return trimmed.isEmpty() ? null : trimmed;
+ }
+
+ private static String trimToEmpty(String value) {
+ return value == null ? "" : value.trim();
+ }
+
+ private static Integer intOrNull(ResultSet rs, String column) throws Exception {
+ Object value = rs.getObject(column);
+ return value instanceof Number ? ((Number) value).intValue() : null;
+ }
+
+ private static Integer characterLength(ResultSet rs) throws Exception {
+ String typeName = rs.getString("TYPE_NAME");
+ if (typeName == null) {
+ return null;
+ }
+ String normalized = typeName.toLowerCase(Locale.ROOT);
+ if (!normalized.contains("char") && !normalized.contains("text") && !normalized.contains("string")) {
+ return null;
+ }
+ return intOrNull(rs, "COLUMN_SIZE");
+ }
+
+ private static String optionalComment(ResultSet rs) {
+ return unchecked(() -> {
+ try {
+ String comment = trimToNull(rs.getString(3));
+ return comment;
+ } catch (Exception e) {
+ return null;
+ }
+ });
+ }
+
+ public static void main(String[] args) {
+ new JsonRpcServer(new SparkAgent()).run();
+ }
+}
diff --git a/agents/metadata-constraint-coverage.tsv b/agents/metadata-constraint-coverage.tsv
index 7a00fc1079..e8b59c4cc9 100644
--- a/agents/metadata-constraint-coverage.tsv
+++ b/agents/metadata-constraint-coverage.tsv
@@ -17,6 +17,7 @@ neo4j intentional-fallback java-graph-metadata Uses JDBC metadata with Cypher fa
oceanbase-oracle native-pushdown java-sql Uses Oracle-compatible metadata SQL with type, filter, stable order, and ROWNUM paging.
oracle-go native-pushdown native-go Uses Oracle-compatible metadata SQL with type, filter, stable order, and ROWNUM paging, with legacy profile guard.
snowflake native-pushdown java-sql Uses INFORMATION_SCHEMA with type, filter, stable order, and literal LIMIT/OFFSET.
+spark intentional-fallback java-show-metadata Uses SHOW TABLES/SHOW DATABASES; stable server-side fuzzy paging is not portable, common constraints filter locally.
sundb native-pushdown java-sql Uses information_schema with type, filter, stable order, and LIMIT/OFFSET.
tdengine intentional-fallback java-show-metadata Uses SHOW STABLES/TABLES; stable server-side fuzzy paging is not portable, common constraints filter locally.
trino native-pushdown java-sql Uses information_schema.tables with type, filter, stable order, and literal LIMIT/OFFSET.
diff --git a/agents/settings.gradle b/agents/settings.gradle
index 5d0be1832f..083223780d 100644
--- a/agents/settings.gradle
+++ b/agents/settings.gradle
@@ -4,7 +4,7 @@ def infrastructureModules = ['common', 'test-support']
def driverModules = [
'access', 'dameng', 'kingbase', 'vastbase', 'goldendb', 'databend', 'databricks', 'saphana',
'teradata', 'vertica', 'firebird', 'exasol', 'oceanbase-oracle', 'gbase8a', 'gbase8s',
- 'bigquery', 'kylin', 'sundb', 'h2', 'snowflake', 'trino', 'hive',
+ 'bigquery', 'kylin', 'sundb', 'h2', 'snowflake', 'trino', 'hive', 'spark',
'db2', 'informix', 'neo4j', 'cassandra', 'mongodb', 'highgo', 'tdengine', 'yashandb', 'oscar',
'iris', 'iotdb', 'etcd', 'zookeeper', 'kafka'
]
diff --git a/agents/versions.json b/agents/versions.json
index 1c85c991b3..fa697d10a7 100644
--- a/agents/versions.json
+++ b/agents/versions.json
@@ -13,6 +13,7 @@
"goldendb": "0.1.28",
"h2": "0.1.28",
"hive": "0.1.28",
+ "spark": "0.1.0",
"informix": "0.1.29",
"kingbase": "0.1.28",
"kylin": "0.1.28",
diff --git a/apps/desktop/public/icons/database/spark-logo.png b/apps/desktop/public/icons/database/spark-logo.png
new file mode 100644
index 0000000000..16702a9f02
Binary files /dev/null and b/apps/desktop/public/icons/database/spark-logo.png differ
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index cea62a8da4..e7721ae8f4 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -612,6 +612,7 @@ const driverProfiles: Record<
trino: { type: "trino", port: 8080, user: "", label: "Trino", icon: "trino" },
prestosql: { type: "prestosql", port: 8080, user: "", label: "PrestoSQL", icon: "presto" },
hive: { type: "hive", port: 10000, user: "", label: "Apache Hive", icon: "hive" },
+ spark: { type: "spark", port: 10015, user: "", label: "Apache Spark", icon: "spark-logo.png" },
db2: { type: "db2", port: 50000, user: "db2inst1", label: "IBM DB2", icon: "db2" },
informix: { type: "informix", port: 9088, user: "informix", label: "Informix", icon: "informix" },
dremio: { type: "jdbc", port: 31010, user: "", label: "Dremio", icon: "dremio" },
@@ -1524,6 +1525,7 @@ const iconTypeMap: Record<string, string> = {
trino: "trino",
prestosql: "prestosql",
hive: "hive",
+ spark: "spark-logo.png",
db2: "db2",
informix: "informix",
dremio: "dremio",
@@ -1593,6 +1595,7 @@ const dbOptions: DbOption[] = [
{ value: "trino", label: "Trino" },
{ value: "prestosql", label: "PrestoSQL" },
{ value: "hive", label: "Hive" },
+ { value: "spark", label: "Apache Spark" },
{ value: "db2", label: "DB2" },
{ value: "informix", label: "Informix" },
{ value: "neo4j", label: "Neo4j" },
@@ -4422,7 +4425,9 @@ function openExternalUrl(url: string) {
? 'OAuthType=0;[email protected];OAuthPvtKeyPath=/path/key.json'
: form.db_type === 'informix'
? 'CLIENT_LOCALE=en_US.utf8;DB_LOCALE=en_US.utf8'
- : 'sslmode=disable'
+ : form.db_type === 'spark'
+ ? 'catalog=paimon_catalog'
+ : 'sslmode=disable'
"
/>
</div>
diff --git a/apps/desktop/src/components/icons/DatabaseIcon.vue b/apps/desktop/src/components/icons/DatabaseIcon.vue
index c712df2d0f..9cac04e3c8 100644
--- a/apps/desktop/src/components/icons/DatabaseIcon.vue
+++ b/apps/desktop/src/components/icons/DatabaseIcon.vue
@@ -47,6 +47,7 @@ const assetIcons: Record<string, string> = {
presto: "presto",
prestosql: "presto",
hive: "hive",
+ spark: "spark-logo.png",
apache_kylin: "apache_kylin",
sundb: "sundb",
trino: "trino",
diff --git a/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts b/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts
index fc3ddfc6dc..0b6f6709f5 100644
--- a/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts
+++ b/apps/desktop/src/lib/connection/connectionAttemptTimeout.ts
@@ -29,6 +29,7 @@ const DRIVER_STARTUP_FLOOR_TYPES = new Set<DatabaseType>([
"prestosql",
"jdbc",
"hive",
+ "spark",
"db2",
"informix",
"neo4j",
diff --git a/apps/desktop/src/lib/database/databaseCapabilitySets.ts b/apps/desktop/src/lib/database/databaseCapabilitySets.ts
index 5ef1ffc871..7155c88ce4 100644
--- a/apps/desktop/src/lib/database/databaseCapabilitySets.ts
+++ b/apps/desktop/src/lib/database/databaseCapabilitySets.ts
@@ -26,6 +26,7 @@ export const SCHEMA_AWARE_TYPES = new Set<DatabaseType>([
"trino",
"prestosql",
"hive",
+ "spark",
"databend",
"db2",
"informix",
diff --git a/apps/desktop/src/lib/database/databaseNamespaceCreation.ts b/apps/desktop/src/lib/database/databaseNamespaceCreation.ts
index 462e4b4404..63cdde552b 100644
--- a/apps/desktop/src/lib/database/databaseNamespaceCreation.ts
+++ b/apps/desktop/src/lib/database/databaseNamespaceCreation.ts
@@ -60,6 +60,7 @@ export const DATABASE_NAMESPACE_CREATION_MATRIX = {
trino: { database: "schema" },
prestosql: { database: "schema" },
hive: { deferred: "Hive database creation needs agent metadata validation first" },
+ spark: { deferred: "Spark database creation needs agent metadata validation first" },
db2: { database: "schema" },
informix: { database: "schema" },
neo4j: { deferred: "database creation depends on edition/admin privileges" },
diff --git a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts b/apps/desktop/src/lib/database/databaseObjectCapabilities.ts
index 51b5beca8f..381a4cab8c 100644
--- a/apps/desktop/src/lib/database/databaseObjectCapabilities.ts
+++ b/apps/desktop/src/lib/database/databaseObjectCapabilities.ts
@@ -40,6 +40,7 @@ const DATABASE_TYPE_OBJECTS = new Map<DatabaseType, SidebarObjectKind[]>([
["doris", TABLE_VIEW_OBJECTS],
["starrocks", TABLE_VIEW_OBJECTS],
["hive", TABLE_VIEW_OBJECTS],
+ ["spark", TABLE_VIEW_OBJECTS],
["trino", TABLE_VIEW_OBJECTS],
["prestosql", TABLE_VIEW_OBJECTS],
["cassandra", TABLE_VIEW_OBJECTS],
diff --git a/apps/desktop/src/lib/database/databasePropertyEditing.ts b/apps/desktop/src/lib/database/databasePropertyEditing.ts
index f7f1947e7c..9012d3d832 100644
--- a/apps/desktop/src/lib/database/databasePropertyEditing.ts
+++ b/apps/desktop/src/lib/database/databasePropertyEditing.ts
@@ -61,6 +61,7 @@ export const DATABASE_PROPERTY_EDITING_MATRIX = {
trino: { deferred: "catalog properties are connector-managed" },
prestosql: { deferred: "catalog properties are connector-managed" },
hive: { deferred: "database properties need agent metadata validation first" },
+ spark: { deferred: "database properties need agent metadata validation first" },
db2: { deferred: "schema properties need product-specific handling" },
informix: { deferred: "schema properties need product-specific handling" },
neo4j: { deferred: "database properties depend on edition/admin privileges" },
diff --git a/apps/desktop/src/lib/table/tableSelectSql.ts b/apps/desktop/src/lib/table/tableSelectSql.ts
index 690312c7ae..54bfa78275 100644
--- a/apps/desktop/src/lib/table/tableSelectSql.ts
+++ b/apps/desktop/src/lib/table/tableSelectSql.ts
@@ -23,7 +23,7 @@ export function quoteTableIdentifier(databaseType: DatabaseType | undefined, nam
// JDBC connections use the driver-reported identifier quote string
// (DatabaseMetaData.getIdentifierQuoteString()) — pass through unquoted.
if (databaseType === "jdbc") return name;
- if (databaseType === "mysql" || databaseType === "clickhouse" || databaseType === "hive" || databaseType === "databend" || databaseType === "tdengine" || databaseType === "access") return `\`${name.replace(/`/g, "``")}\``;
+ if (databaseType === "mysql" || databaseType === "clickhouse" || databaseType === "hive" || databaseType === "spark" || 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);
if (databaseType === "sqlserver") return `[${name.replace(/\]/g, "]]")}]`;
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 83beb1a8e5..2d710c99df 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -787,6 +787,7 @@ export const useConnectionStore = defineStore("connection", () => {
trino: "Trino",
prestosql: "PrestoSQL",
hive: "Hive",
+ spark: "Apache Spark",
db2: "DB2",
informix: "Informix",
neo4j: "Neo4j",
diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts
index b12fc0eed8..cddc9c2d9b 100644
--- a/apps/desktop/src/types/database.ts
+++ b/apps/desktop/src/types/database.ts
@@ -44,6 +44,7 @@ export type DatabaseType =
| "trino"
| "prestosql"
| "hive"
+ | "spark"
| "db2"
| "informix"
| "neo4j"
diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.json
index 20c0d6336c..2d757b5308 100644
--- a/crates/dbx-core/assets/database-drivers.manifest.json
+++ b/crates/dbx-core/assets/database-drivers.manifest.json
@@ -1820,6 +1820,36 @@
"userAdmin": false,
"driverManagement": false
}
+ },
+ {
+ "dbType": "spark",
+ "label": "Apache Spark",
+ "runtimeMode": "agent",
+ "mcpMode": "bridge",
+ "agentKey": "spark",
+ "singleConnectionPool": false,
+ "metadataConnectionScoped": false,
+ "skipTcpProbe": true,
+ "defaultPort": 10015,
+ "supportLevel": "operate",
+ "capabilities": {
+ "queryExecution": true,
+ "metadataBrowse": true,
+ "objectBrowser": true,
+ "objectSource": false,
+ "schemaSearch": true,
+ "diagram": false,
+ "tableDataEdit": true,
+ "tableStructureEdit": false,
+ "tableImport": false,
+ "dataTransfer": true,
+ "sqlFileExecution": true,
+ "databaseCreate": false,
+ "fieldLineage": false,
+ "sqlExplain": false,
+ "userAdmin": false,
+ "driverManagement": true
+ }
}
]
}
diff --git a/crates/dbx-core/src/agent_catalog.rs b/crates/dbx-core/src/agent_catalog.rs
index 1528c96dd3..cfe9e7e768 100644
--- a/crates/dbx-core/src/agent_catalog.rs
+++ b/crates/dbx-core/src/agent_catalog.rs
@@ -173,6 +173,13 @@ const AGENT_CATALOG: &[AgentCatalogEntry] = &[
store_visible: true,
profiles: &[],
},
+ AgentCatalogEntry {
+ db_type: DatabaseType::Spark,
+ key: "spark",
+ label: "Apache Spark",
+ store_visible: true,
+ profiles: &[],
+ },
AgentCatalogEntry { db_type: DatabaseType::Db2, key: "db2", label: "IBM DB2", store_visible: true, profiles: &[] },
AgentCatalogEntry {
db_type: DatabaseType::Informix,
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index 886aab8f12..96f2a31338 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -143,6 +143,7 @@ macro_rules! agent_connection_pool_database_type {
| DatabaseType::Snowflake
| DatabaseType::Trino
| DatabaseType::Hive
+ | DatabaseType::Spark
| DatabaseType::Db2
| DatabaseType::Informix
| DatabaseType::Neo4j
diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rs
index 5b458f6529..b2b5a33970 100644
--- a/crates/dbx-core/src/models/connection.rs
+++ b/crates/dbx-core/src/models/connection.rs
@@ -337,6 +337,7 @@ pub enum DatabaseType {
#[serde(rename = "prestosql")]
PrestoSql,
Hive,
+ Spark,
#[serde(rename = "db2")]
Db2,
Informix,
@@ -845,6 +846,7 @@ impl ConnectionConfig {
DatabaseType::Trino => format!("trino://{host}:{port}{db_part}"),
DatabaseType::PrestoSql => format!("prestosql://{host}:{port}{db_part}"),
DatabaseType::Hive => format!("hive://{host}:{port}{db_part}"),
+ DatabaseType::Spark => format!("spark://{host}:{port}{db_part}"),
DatabaseType::Db2 => format!("db2://{host}:{port}{db_part}"),
DatabaseType::Informix => format!("informix://{host}:{port}{db_part}"),
DatabaseType::Neo4j => format!("neo4j://{host}:{port}{db_part}"),
@@ -1034,6 +1036,9 @@ impl ConnectionConfig {
DatabaseType::Hive => {
format!("hive://{}:{}@{host}:{port}{db_part}", username, password)
}
+ DatabaseType::Spark => {
+ format!("spark://{}:{}@{host}:{port}{db_part}", username, password)
+ }
DatabaseType::Db2 => {
format!("db2://{}:{}@{host}:{port}{db_part}", username, password)
}
diff --git a/crates/dbx-core/src/sql_dialect/capabilities.rs b/crates/dbx-core/src/sql_dialect/capabilities.rs
index 228501bb1d..cf4bd26626 100644
--- a/crates/dbx-core/src/sql_dialect/capabilities.rs
+++ b/crates/dbx-core/src/sql_dialect/capabilities.rs
@@ -52,6 +52,7 @@ pub fn is_schema_aware(database_type: DatabaseType) -> bool {
| DatabaseType::Trino
| DatabaseType::PrestoSql
| DatabaseType::Hive
+ | DatabaseType::Spark
| DatabaseType::Db2
| DatabaseType::Tdengine
| DatabaseType::Xugu
diff --git a/crates/dbx-core/src/sql_dialect/identifiers.rs b/crates/dbx-core/src/sql_dialect/identifiers.rs
index 52fde76c9d..a00944aad7 100644
--- a/crates/dbx-core/src/sql_dialect/identifiers.rs
+++ b/crates/dbx-core/src/sql_dialect/identifiers.rs
@@ -86,6 +86,7 @@ pub fn quote_table_identifier(database_type: Option<DatabaseType>, name: &str) -
| DatabaseType::StarRocks
| DatabaseType::ManticoreSearch
| DatabaseType::Hive
+ | DatabaseType::Spark
| DatabaseType::Databend
| DatabaseType::Tdengine
| DatabaseType::Access
@@ -119,6 +120,7 @@ pub(crate) fn quote_transfer_identifier(name: &str, database_type: &DatabaseType
| DatabaseType::Doris
| DatabaseType::StarRocks
| DatabaseType::Hive
+ | DatabaseType::Spark
| DatabaseType::Questdb => format!("`{}`", name.replace('`', "``")),
DatabaseType::SqlServer => format!("[{}]", name.replace(']', "]]")),
_ => format!("\"{}\"", name.replace('\"', "\"\"")),
diff --git a/packages/mcp-server/src/index.ts b/packages/mcp-server/src/index.ts
index 7b1e441714..ab88b1650e 100644
--- a/packages/mcp-server/src/index.ts
+++ b/packages/mcp-server/src/index.ts
@@ -68,7 +68,7 @@ function formatRedisCommandToolResult(result: RedisCommandResult) {
}
export const DBX_CONNECTION_TYPE_DESCRIPTION =
- "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, etcd, doris, starrocks, manticoresearch, milvus, qdrant, weaviate, chromadb, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, questdb, gbase, h2, snowflake, trino, prestosql, hive, db2, informix, influxdb, iris, neo4j, cassandra, bigquery, kylin, sundb, oscar, tdengine, iotdb, xugu, zookeeper, jdbc, access, mq";
+ "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, etcd, doris, starrocks, manticoresearch, milvus, qdrant, weaviate, chromadb, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, questdb, gbase, h2, snowflake, trino, prestosql, hive, spark, db2, informix, influxdb, iris, neo4j, cassandra, bigquery, kylin, sundb, oscar, tdengine, iotdb, xugu, zookeeper, jdbc, access, mq";
const FILE_CAPABLE_CONNECTION_TYPES = new Set(["sqlite", "duckdb", "access", "h2"]);
interface McpScope {
diff --git a/packages/node-core/src/diagnostics.ts b/packages/node-core/src/diagnostics.ts
index 1c11ef6285..0cc620cc45 100644
--- a/packages/node-core/src/diagnostics.ts
+++ b/packages/node-core/src/diagnostics.ts
@@ -49,6 +49,7 @@ export const BRIDGE_REQUIRED_TYPES = [
"trino",
"prestosql",
"hive",
+ "spark",
"db2",
"informix",
"iris",