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。

fix(connection): expose BigQuery auth params

t8y29d7ca42acf61
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index d3b9c3b612..dc37a1c878 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -129,6 +129,7 @@ const driverProfiles: Record<
user: string;
label: string;
icon: string;
+ host?: string;
urlParams?: string;
}
> = {
@@ -230,7 +231,14 @@ const driverProfiles: Record<
informix: { type: "informix", port: 9088, user: "informix", label: "Informix", icon: "informix" },
neo4j: { type: "neo4j", port: 7687, user: "neo4j", label: "Neo4j", icon: "neo4j" },
cassandra: { type: "cassandra", port: 9042, user: "cassandra", label: "Cassandra", icon: "cassandra" },
- bigquery: { type: "bigquery", port: 443, user: "", label: "BigQuery", icon: "bigquery" },
+ bigquery: {
+ type: "bigquery",
+ port: 443,
+ user: "",
+ label: "BigQuery",
+ icon: "bigquery",
+ host: "https://www.googleapis.com/bigquery/v2",
+ },
kylin: { type: "kylin", port: 7070, user: "ADMIN", label: "Apache Kylin", icon: "kylin" },
sundb: { type: "sundb", port: 22000, user: "root", label: "SunDB", icon: "sundb" },
jdbc: { type: "jdbc", port: 0, user: "", label: "JDBC", icon: "jdbc" },
@@ -282,6 +290,9 @@ function applyProfile(val: string, preserveConnectionFields = false) {
form.value.port = profile.port;
form.value.username = profile.user;
form.value.url_params = profile.urlParams || "";
+ if (profile.host) {
+ form.value.host = profile.host;
+ }
if (profile.type === "sqlite" || profile.type === "duckdb" || profile.type === "access") {
form.value.host = "";
}
@@ -1480,7 +1491,8 @@ function openExternalUrl(url: string) {
form.db_type === 'yashandb' ||
form.db_type === 'vastbase' ||
form.db_type === 'goldendb' ||
- form.db_type === 'saphana'
+ form.db_type === 'saphana' ||
+ form.db_type === 'bigquery'
"
class="grid grid-cols-4 items-center gap-4"
>
@@ -1493,9 +1505,11 @@ function openExternalUrl(url: string) {
? 'charset=utf8mb4'
: form.db_type === 'saphana'
? 'databaseName=TENANT_DB'
- : form.db_type === 'informix'
- ? 'INFORMIXSERVER=informix;CLIENT_LOCALE=en_US.utf8;DB_LOCALE=en_US.utf8'
- : 'sslmode=disable'
+ : form.db_type === 'bigquery'
+ ? 'OAuthType=0;[email protected];OAuthPvtKeyPath=/path/key.json'
+ : form.db_type === 'informix'
+ ? 'INFORMIXSERVER=informix;CLIENT_LOCALE=en_US.utf8;DB_LOCALE=en_US.utf8'
+ : 'sslmode=disable'
"
/>
</div>
diff --git a/apps/desktop/src/lib/connectionPresentation.ts b/apps/desktop/src/lib/connectionPresentation.ts
index 5c8d9f9672..d08f4e040e 100644
--- a/apps/desktop/src/lib/connectionPresentation.ts
+++ b/apps/desktop/src/lib/connectionPresentation.ts
@@ -70,6 +70,9 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
case "tdengine":
return "tdengine://user:password@host:6041/database";
+ case "bigquery":
+ return "bigquery://https://www.googleapis.com/bigquery/v2:443/project-id";
+
case "jdbc":
return "jdbc:mysql://host:3306/database";
diff --git a/packages/app-tests/connectionDialogBigQuery.test.ts b/packages/app-tests/connectionDialogBigQuery.test.ts
new file mode 100644
index 0000000000..ad76f847f3
--- /dev/null
+++ b/packages/app-tests/connectionDialogBigQuery.test.ts
@@ -0,0 +1,18 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+
+const source = readFileSync("apps/desktop/src/components/connection/ConnectionDialog.vue", "utf8");
+
+test("BigQuery profile uses the Google API endpoint and port 443", () => {
+ assert.match(
+ source,
+ /bigquery:\s*\{\s*type:\s*"bigquery",\s*port:\s*443,\s*user:\s*"",\s*label:\s*"BigQuery",\s*icon:\s*"bigquery",\s*host:\s*"https:\/\/www\.googleapis\.com\/bigquery\/v2"/,
+ );
+});
+
+test("BigQuery connection form exposes URL params for authentication properties", () => {
+ assert.match(source, /form\.db_type === 'bigquery'/);
+ assert.match(source, /OAuthType=0;OAuthServiceAcctEmail=/);
+ assert.match(source, /OAuthPvtKeyPath=/);
+});
diff --git a/packages/app-tests/connectionUrlPlaceholder.test.ts b/packages/app-tests/connectionUrlPlaceholder.test.ts
index 928fbf5480..78c44bb658 100644
--- a/packages/app-tests/connectionUrlPlaceholder.test.ts
+++ b/packages/app-tests/connectionUrlPlaceholder.test.ts
@@ -20,6 +20,7 @@ const expected: Record<string, string> = {
elasticsearch: "http://user:password@host:port",
dameng: "dm://user:password@host:port",
tdengine: "tdengine://user:password@host:6041/database",
+ bigquery: "bigquery://https://www.googleapis.com/bigquery/v2:443/project-id",
jdbc: "jdbc:mysql://host:3306/database",
};