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(vector): add qdrant and milvus support

t8y2e27d34a34ad3
diff --git a/apps/desktop/public/icons/database/milvus.png b/apps/desktop/public/icons/database/milvus.png
new file mode 100644
index 0000000000..4d3214c7df
Binary files /dev/null and b/apps/desktop/public/icons/database/milvus.png differ
diff --git a/apps/desktop/public/icons/database/qdrant.svg b/apps/desktop/public/icons/database/qdrant.svg
new file mode 100644
index 0000000000..c10ad96f11
--- /dev/null
+++ b/apps/desktop/public/icons/database/qdrant.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="Capa_2" data-name="Capa 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 346.42 400">
+ <defs>
+ <style>
+ .cls-1 {
+ fill: #9e0d38;
+ }
+
+ .cls-2 {
+ fill: #dc244c;
+ }
+
+ .cls-3 {
+ fill: #ff516b;
+ }
+ </style>
+ </defs>
+ <g id="Vectors">
+ <g>
+ <g>
+ <polygon class="cls-2" points="173.21 0 0 100 0 300 173.21 400 238.16 362.5 238.16 287.5 173.21 325 64.96 262.5 64.96 137.5 173.21 75 281.46 137.5 281.46 387.5 346.42 350 346.42 100 173.21 0"/>
+ <polygon class="cls-2" points="108.26 162.5 108.26 237.5 173.21 275 238.16 237.5 238.16 162.5 173.21 125 108.26 162.5"/>
+ </g>
+ <g>
+ <polygon class="cls-1" points="238.16 287.5 238.16 362.5 173.21 400 173.21 325 238.16 287.5"/>
+ <polygon class="cls-1" points="346.42 100 346.42 350 281.46 387.5 281.46 137.5 346.42 100"/>
+ <polygon class="cls-3" points="346.42 100 281.46 137.5 173.21 75 64.96 137.5 0 100 173.21 0 346.42 100"/>
+ <polygon class="cls-2" points="173.21 325 173.21 400 0 300 0 100 64.96 137.5 64.96 262.5 173.21 325"/>
+ <polygon class="cls-3" points="238.16 162.5 173.21 200 108.26 162.5 173.21 125 238.16 162.5"/>
+ <polygon class="cls-2" points="173.21 200 173.21 275 108.26 237.5 108.26 162.5 173.21 200"/>
+ <polygon class="cls-1" points="238.16 162.5 238.16 237.5 173.21 275 173.21 200 238.16 162.5"/>
+ </g>
+ </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue
index b877e89b2c..fe5615f4c0 100644
--- a/apps/desktop/src/components/connection/ConnectionDialog.vue
+++ b/apps/desktop/src/components/connection/ConnectionDialog.vue
@@ -407,6 +407,8 @@ const driverProfiles: Record<
label: "Elasticsearch",
icon: "elasticsearch",
},
+ qdrant: { type: "qdrant", port: 6333, user: "", label: "Qdrant", icon: "qdrant" },
+ milvus: { type: "milvus", port: 19530, user: "root", label: "Milvus", icon: "milvus" },
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" },
@@ -870,6 +872,8 @@ const iconTypeMap: Record<string, string> = {
sqlserver: "sqlserver",
oracle: "oracle",
elasticsearch: "elasticsearch",
+ qdrant: "qdrant",
+ milvus: "milvus",
mariadb: "mariadb",
tidb: "tidb",
oceanbase: "oceanbase",
@@ -933,6 +937,8 @@ const dbOptions: DbOption[] = [
{ value: "sqlite", label: "SQLite" },
{ value: "sqlserver", label: "SQL Server" },
{ value: "elasticsearch", label: "Elasticsearch" },
+ { value: "qdrant", label: "Qdrant" },
+ { value: "milvus", label: "Milvus" },
{ value: "dm", label: "DM (Dameng)" },
{ value: "opengauss", label: "openGauss" },
{ value: "turso", label: "Turso" },
@@ -1034,7 +1040,7 @@ const sqliteExtensionPaths = computed({
form.value.url_params = setSqliteExtensionPaths(form.value.url_params, value);
},
});
-const tlsCapableDatabaseTypes = new Set<DatabaseType>(["mysql", "postgres", "redshift", "gaussdb", "kwdb", "opengauss", "questdb", "redis", "etcd", "clickhouse", "elasticsearch", "influxdb"]);
+const tlsCapableDatabaseTypes = new Set<DatabaseType>(["mysql", "postgres", "redshift", "gaussdb", "kwdb", "opengauss", "questdb", "redis", "etcd", "clickhouse", "elasticsearch", "qdrant", "milvus", "influxdb"]);
const supportsTlsToggle = computed(() => tlsCapableDatabaseTypes.has(form.value.db_type));
const supportsCaCertificatePath = computed(() => form.value.db_type === "clickhouse");
const supportsGenericUrlParams = computed(() => form.value.db_type !== "manticoresearch");
diff --git a/apps/desktop/src/components/diff/DataCompareDialog.vue b/apps/desktop/src/components/diff/DataCompareDialog.vue
index 7ad992c20b..9117cb0cd2 100644
--- a/apps/desktop/src/components/diff/DataCompareDialog.vue
+++ b/apps/desktop/src/components/diff/DataCompareDialog.vue
@@ -114,7 +114,7 @@ const showModified = ref(true);
let syncPlanRequestId = 0;
-const sqlConnections = computed(() => store.connections.filter((connection) => !["redis", "mongodb", "elasticsearch", "etcd"].includes(connection.db_type)));
+const sqlConnections = computed(() => store.connections.filter((connection) => !["redis", "mongodb", "elasticsearch", "qdrant", "milvus", "etcd"].includes(connection.db_type)));
const selectedSourceTableNames = computed(() => sourceTables.value.filter((table) => selectedSourceTables.value.has(table)));
const isBatchCompare = computed(() => selectedSourceTableNames.value.length > 1);
const filteredSourceTables = computed(() => {
diff --git a/apps/desktop/src/components/export/DatabaseExportDialog.vue b/apps/desktop/src/components/export/DatabaseExportDialog.vue
index acc59c5706..fc7f73fb91 100644
--- a/apps/desktop/src/components/export/DatabaseExportDialog.vue
+++ b/apps/desktop/src/components/export/DatabaseExportDialog.vue
@@ -65,7 +65,7 @@ const exportCancelled = ref(false);
const pendingPrefillTable = ref("");
const pendingPrefillTables = ref<string[]>([]);
-const sqlConnections = computed(() => store.connections.filter((c) => !["redis", "mongodb", "elasticsearch", "etcd"].includes(c.db_type)));
+const sqlConnections = computed(() => store.connections.filter((c) => !["redis", "mongodb", "elasticsearch", "qdrant", "milvus", "etcd"].includes(c.db_type)));
const canExport = computed(() => connectionId.value && database.value && schema.value && !loadingTables.value && !tableError.value && (tables.value.length === 0 || selectedTables.value.length > 0) && (includeStructure.value || includeData.value || includeObjects.value) && !isExporting.value);
diff --git a/apps/desktop/src/components/icons/DatabaseIcon.vue b/apps/desktop/src/components/icons/DatabaseIcon.vue
index ec1bb00b04..82565275d9 100644
--- a/apps/desktop/src/components/icons/DatabaseIcon.vue
+++ b/apps/desktop/src/components/icons/DatabaseIcon.vue
@@ -76,6 +76,8 @@ const assetIcons: Record<string, string> = {
xugu: "xugu.png",
iotdb: "iotdb",
etcd: "etcd",
+ qdrant: "qdrant",
+ milvus: "milvus.png",
mq: "pulsar",
pulsar: "pulsar",
iris: "iris.png",
diff --git a/apps/desktop/src/components/layout/AppTabBar.vue b/apps/desktop/src/components/layout/AppTabBar.vue
index 21837b5f97..b27605289f 100644
--- a/apps/desktop/src/components/layout/AppTabBar.vue
+++ b/apps/desktop/src/components/layout/AppTabBar.vue
@@ -216,7 +216,7 @@ function tabColorStyle(tab: QueryTab) {
}
function tabIconClass(tab: QueryTab) {
- if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "redis" || tab.mode === "objects" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
+ if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "vector" || tab.mode === "redis" || tab.mode === "objects" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
return "text-blue-600 dark:text-blue-400";
}
@@ -234,6 +234,7 @@ const openTabMenuItems = computed(() =>
function tabMenuIcon(tab: QueryTab) {
if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "redis") return Table2;
+ if (tab.mode === "vector") return TableProperties;
if (tab.mode === "etcd") return KeyRound;
if (tab.mode === "objects") return TableProperties;
if (tab.mode === "structure") return PencilRuler;
@@ -326,6 +327,7 @@ function activateTab(tabId: string) {
>
<span class="shrink-0" :class="tabIconClass(tab)">
<Table2 v-if="tab.mode === 'data' || tab.mode === 'mongo' || tab.mode === 'redis'" class="h-3.5 w-3.5" />
+ <TableProperties v-else-if="tab.mode === 'vector'" class="h-3.5 w-3.5" />
<KeyRound v-else-if="tab.mode === 'etcd'" class="h-3.5 w-3.5" />
<TableProperties v-else-if="tab.mode === 'objects'" class="h-3.5 w-3.5" />
<PencilRuler v-else-if="tab.mode === 'structure'" class="h-3.5 w-3.5" />
diff --git a/apps/desktop/src/components/layout/ContentArea.vue b/apps/desktop/src/components/layout/ContentArea.vue
index a6981f161d..0e6474e97d 100644
--- a/apps/desktop/src/components/layout/ContentArea.vue
+++ b/apps/desktop/src/components/layout/ContentArea.vue
@@ -36,6 +36,7 @@ const DataGrid = defineAsyncComponent(loadDataGridComponent);
const RedisKeyBrowser = defineAsyncComponent(() => import("@/components/redis/RedisKeyBrowser.vue"));
const EtcdKeyBrowser = defineAsyncComponent(() => import("@/components/etcd/EtcdKeyBrowser.vue"));
const DocumentBrowser = defineAsyncComponent(() => import("@/components/document/DocumentBrowser.vue"));
+const VectorBrowser = defineAsyncComponent(() => import("@/components/vector/VectorBrowser.vue"));
const MqAdminConsole = defineAsyncComponent(() => import("@/components/mq/MqAdminConsole.vue"));
const ObjectBrowser = defineAsyncComponent(() => import("@/components/objects/ObjectBrowser.vue"));
const TableStructureEditor = defineAsyncComponent(() => import("@/components/structure/TableStructureEditor.vue"));
@@ -993,6 +994,13 @@ defineExpose({ focusSearch, refreshData, handleModRTarget });
</div>
</template>
+ <!-- Vector mode: Qdrant and Milvus collections -->
+ <template v-else-if="activeTab.mode === 'vector'">
+ <div class="flex-1 min-h-0">
+ <VectorBrowser :key="activeTab.id" :connection-id="activeTab.connectionId" :database="activeTab.database" :collection="activeTab.sql" :database-type="activeEffectiveDatabaseType" />
+ </div>
+ </template>
+
<template v-else-if="activeTab.mode === 'mq'">
<div class="flex-1 min-h-0">
<MqAdminConsole :key="activeTab.id" :connection-id="activeTab.connectionId" :initial-tenant="activeTab.mqTenant" :read-only="activeConnection?.read_only ?? false" />
diff --git a/apps/desktop/src/components/layout/EditorToolbar.vue b/apps/desktop/src/components/layout/EditorToolbar.vue
index d95225a1ae..848e98015d 100644
--- a/apps/desktop/src/components/layout/EditorToolbar.vue
+++ b/apps/desktop/src/components/layout/EditorToolbar.vue
@@ -61,7 +61,7 @@ const activeConnectionValue = computed(() => props.activeConnection?.id || "");
const activeSchemaValue = computed(() => props.activeTab.schema || "");
const supportsExplain = computed(() => {
const dbType = props.activeConnection?.db_type;
- return dbType !== "redis" && dbType !== "mongodb" && dbType !== "elasticsearch" && dbType !== "etcd";
+ return dbType !== "redis" && dbType !== "mongodb" && dbType !== "elasticsearch" && dbType !== "qdrant" && dbType !== "milvus" && dbType !== "etcd";
});
const isSingleDb = computed(() => isSingleDatabase(props.activeConnection?.db_type));
const hasDefaultDatabaseOption = computed(() => activeDatabaseOptions.value.includes(""));
@@ -250,7 +250,7 @@ function connectionById(connectionId: string): ConnectionConfig | undefined {
</template>
</SearchableSelect>
</div>
- <div v-if="activeConnection?.db_type !== 'elasticsearch' && !isSingleDb" class="flex items-center gap-1">
+ <div v-if="activeConnection?.db_type !== 'elasticsearch' && activeConnection?.db_type !== 'qdrant' && activeConnection?.db_type !== 'milvus' && !isSingleDb" class="flex items-center gap-1">
<Database class="h-3.5 w-3.5 shrink-0" />
<SearchableSelect
:model-value="activeDatabaseValue"
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index 1389de6bed..775a6c13d7 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -83,7 +83,7 @@ const SEARCH_SCOPE_TO_NODE_TYPES: Record<SearchScope, TreeNodeType[]> = {
connection: ["connection"],
database: ["database", "redis-db", "mq-tenant", "mongo-db"],
schema: ["schema"],
- table: ["table", "mongo-collection", "elasticsearch-index"],
+ table: ["table", "mongo-collection", "vector-collection", "elasticsearch-index"],
view: ["view"],
};
@@ -336,6 +336,8 @@ async function ensureTreeLoadedForTarget(target: ActiveTabSidebarTarget, opts?:
await store.loadMongoDatabases(connId);
} else if (config.db_type === "elasticsearch") {
await store.loadElasticsearchIndices(connId);
+ } else if (config.db_type === "qdrant" || config.db_type === "milvus") {
+ await store.loadVectorCollections(connId);
} else if (config.db_type === "mq") {
await store.loadMqTenants(connId, loadOptions);
} else {
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 45964cc876..dc7433e8a7 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -247,6 +247,8 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
return { icon: Database, colorClass: "text-yellow-500" };
case "mongo-collection":
return { icon: Table, colorClass: "text-green-400" };
+ case "vector-collection":
+ return { icon: TableProperties, colorClass: "text-cyan-400" };
case "elasticsearch-index":
return { icon: Table, colorClass: "text-emerald-400" };
case "procedure":
@@ -283,7 +285,7 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
}
const groupTypes: Set<TreeNodeType> = new Set(["group-columns", "group-indexes", "group-fkeys", "group-triggers", "group-tables", "group-views", "group-materialized-views", "group-procedures", "group-functions", "group-sequences", "group-packages", "group-partitions"]);
-const pinnableTypes: Set<TreeNodeType> = new Set(["connection-group", "database", "linked-server", "linked-server-catalog", "linked-server-schema", "schema", "table", "view", "materialized_view", "redis-db", "mongo-db", "mongo-collection", "elasticsearch-index"]);
+const pinnableTypes: Set<TreeNodeType> = new Set(["connection-group", "database", "linked-server", "linked-server-catalog", "linked-server-schema", "schema", "table", "view", "materialized_view", "redis-db", "mongo-db", "mongo-collection", "vector-collection", "elasticsearch-index"]);
function isGroupLabel(node: TreeNode): boolean {
return groupTypes.has(node.type);
@@ -299,7 +301,7 @@ function displayLabel(node: TreeNode): string {
}
function visibleLabel(node: TreeNode): string {
- if (node.type === "table" || node.type === "view" || node.type === "materialized_view" || node.type === "mongo-collection" || node.type === "elasticsearch-index") {
+ if (node.type === "table" || node.type === "view" || node.type === "materialized_view" || node.type === "mongo-collection" || node.type === "vector-collection" || node.type === "elasticsearch-index") {
return sidebarDisplayTableName(node.label, settingsStore.editorSettings.sidebarHiddenTablePrefixes);
}
return displayLabel(node);
@@ -335,6 +337,8 @@ function connectionTooltipScheme(config: Pick<ConnectionConfig, "db_type" | "ssl
case "sqlserver":
return "mssql";
case "elasticsearch":
+ case "qdrant":
+ case "milvus":
case "rqlite":
case "turso":
case "mq":
@@ -455,6 +459,8 @@ async function toggle() {
await connectionStore.loadMongoDatabases(node.connectionId);
} else if (config?.db_type === "elasticsearch") {
await connectionStore.loadElasticsearchIndices(node.connectionId);
+ } else if (config?.db_type === "qdrant" || config?.db_type === "milvus") {
+ await connectionStore.loadVectorCollections(node.connectionId);
} else if (config?.db_type === "mq") {
await connectionStore.loadMqTenants(node.connectionId);
} else {
@@ -479,6 +485,9 @@ async function toggle() {
} else if (node.type === "elasticsearch-index" && node.connectionId) {
const tab = queryStore.createTab(node.connectionId, node.database || "default", node.label, "mongo");
queryStore.updateSql(tab, node.label);
+ } else if (node.type === "vector-collection" && node.connectionId) {
+ const tab = queryStore.createTab(node.connectionId, node.database || "default", node.label, "vector");
+ queryStore.updateSql(tab, node.label);
} else if (node.type === "database" && node.connectionId && hasTreeNodeDatabaseContext(node)) {
const config = connectionStore.getConfig(node.connectionId);
const effectiveDbType = effectiveDatabaseTypeForConnection(config);
@@ -2722,7 +2731,9 @@ const hasTypeMenu = computed(() => {
return t === "connection" || t === "database" || t === "schema" || t === "table" || t === "view" || t === "column" || t === "procedure" || t === "function" || t === "package" || t === "package-body" || isGroupLabel(props.node);
});
const columnComment = computed(() => (!settingsStore.editorSettings.sidebarHideTableComments && props.node.type === "column" && props.node.meta && "comment" in props.node.meta ? (props.node.meta as any).comment : null));
-const tableComment = computed(() => (!settingsStore.editorSettings.sidebarHideTableComments && (props.node.type === "table" || props.node.type === "view" || props.node.type === "mongo-collection" || props.node.type === "elasticsearch-index") && props.node.comment ? props.node.comment : null));
+const tableComment = computed(() =>
+ !settingsStore.editorSettings.sidebarHideTableComments && (props.node.type === "table" || props.node.type === "view" || props.node.type === "mongo-collection" || props.node.type === "vector-collection" || props.node.type === "elasticsearch-index") && props.node.comment ? props.node.comment : null,
+);
const paddingLeft = computed(() => treeItemPaddingLeft(props.depth));
const isConnected = computed(() => props.node.type === "connection" && !!props.node.connectionId && connectionStore.connectedIds.has(props.node.connectionId));
const isConnectionReadonly = computed(() => props.node.type === "connection" && !!props.node.connectionId && (connectionStore.getConfig(props.node.connectionId)?.read_only ?? false));
@@ -2735,7 +2746,7 @@ const nodeIconClass = computed(() => {
const canConfigureVisibleDatabases = computed(() => {
if (props.node.type !== "connection" || !props.node.connectionId) return false;
const dbType = connectionStore.getConfig(props.node.connectionId)?.db_type;
- return dbType !== "elasticsearch" && dbType !== "etcd" && dbType !== "mq";
+ return dbType !== "elasticsearch" && dbType !== "qdrant" && dbType !== "milvus" && dbType !== "etcd" && dbType !== "mq";
});
const canCopyFinalProxyPort = computed(() => {
if (props.node.type !== "connection" || !props.node.connectionId) return false;
@@ -3325,7 +3336,7 @@ function treeItemMenuItems(): ContextMenuItem[] {
return items;
}
- if (node.type === "elasticsearch-index") {
+ if (node.type === "elasticsearch-index" || node.type === "vector-collection") {
items.push({ label: t("contextMenu.copyName"), action: copyName, icon: Copy, shortcut: shortcutCopyName.value });
items.push({ label: "", separator: true });
items.push({ label: t("contextMenu.viewData"), action: toggle, icon: TableProperties });
diff --git a/apps/desktop/src/components/sql-file/SqlFileExecutionDialog.vue b/apps/desktop/src/components/sql-file/SqlFileExecutionDialog.vue
index f60e1d0181..a515027d50 100644
--- a/apps/desktop/src/components/sql-file/SqlFileExecutionDialog.vue
+++ b/apps/desktop/src/components/sql-file/SqlFileExecutionDialog.vue
@@ -49,7 +49,7 @@ const terminalStatus = ref<SqlFileStatus | "idle">("idle");
const terminalError = ref("");
const refreshedTarget = ref(false);
-const sqlConnections = computed(() => store.connections.filter((c) => !["redis", "mongodb", "elasticsearch", "etcd"].includes(c.db_type)));
+const sqlConnections = computed(() => store.connections.filter((c) => !["redis", "mongodb", "elasticsearch", "qdrant", "milvus", "etcd"].includes(c.db_type)));
const selectedConnection = computed(() => sqlConnections.value.find((c) => c.id === connectionId.value));
diff --git a/apps/desktop/src/components/vector/VectorBrowser.vue b/apps/desktop/src/components/vector/VectorBrowser.vue
new file mode 100644
index 0000000000..8a8a6daa81
--- /dev/null
+++ b/apps/desktop/src/components/vector/VectorBrowser.vue
@@ -0,0 +1,256 @@
+<script setup lang="ts">
+import { computed, ref, watch, defineAsyncComponent } from "vue";
+import { Play, RefreshCcw, RotateCcw, Save, Trash2 } from "@lucide/vue";
+import { useI18n } from "vue-i18n";
+import { Button } from "@/components/ui/button";
+import ErrorBanner from "@/components/ui/ErrorBanner.vue";
+import QueryLoadingState from "@/components/common/QueryLoadingState.vue";
+import * as api from "@/lib/api";
+import { uuid } from "@/lib/utils";
+import type { DatabaseType, QueryResult } from "@/types/database";
+
+const DataGrid = defineAsyncComponent(() => import("@/components/grid/DataGrid.vue"));
+const { t } = useI18n();
+
+type VectorOperationMode = "browse" | "upsert" | "delete";
+
+const props = defineProps<{
+ connectionId: string;
+ database: string;
+ collection: string;
+ databaseType?: DatabaseType;
+}>();
+
+const loading = ref(false);
+const cancelling = ref(false);
+const executionId = ref("");
+const elapsedSeconds = ref("0.0");
+const error = ref("");
+const statusMessage = ref("");
+const result = ref<QueryResult>(emptyResult());
+const operationMode = ref<VectorOperationMode>("browse");
+const requestText = ref(defaultRequestText(props.databaseType, props.database, props.collection, operationMode.value));
+let loadingTimer: ReturnType<typeof setInterval> | undefined;
+
+const productLabel = computed(() => (props.databaseType === "milvus" ? "Milvus" : "Qdrant"));
+const collectionLabel = computed(() => props.collection || t("vector.collectionFallback"));
+const executeLabel = computed(() => (operationMode.value === "browse" ? t("vector.run") : t("vector.apply")));
+const operationIcon = computed(() => (operationMode.value === "delete" ? Trash2 : operationMode.value === "upsert" ? Save : Play));
+
+watch(
+ () => [props.databaseType, props.database, props.collection] as const,
+ ([databaseType, database, collection]) => {
+ requestText.value = defaultRequestText(databaseType, database, collection, operationMode.value);
+ result.value = emptyResult();
+ error.value = "";
+ statusMessage.value = "";
+ },
+);
+
+function emptyResult(): QueryResult {
+ return {
+ columns: [],
+ column_types: [],
+ column_sortables: [],
+ rows: [],
+ affected_rows: 0,
+ execution_time_ms: 0,
+ };
+}
+
+function pathSegment(value: string): string {
+ return encodeURIComponent(value || "collection");
+}
+
+function defaultRequestText(databaseType: DatabaseType | undefined, database: string, collection: string, mode: VectorOperationMode): string {
+ if (databaseType === "milvus") {
+ const body =
+ mode === "delete"
+ ? {
+ dbName: database || "default",
+ collectionName: collection,
+ filter: "id in [1]",
+ }
+ : mode === "upsert"
+ ? {
+ dbName: database || "default",
+ collectionName: collection,
+ data: [
+ {
+ id: 1,
+ vector: [0.1, 0.2, 0.3, 0.4],
+ title: "updated vector",
+ kind: "demo",
+ },
+ ],
+ }
+ : {
+ dbName: database || "default",
+ collectionName: collection,
+ filter: "",
+ limit: 100,
+ outputFields: ["*"],
+ };
+ const endpoint = mode === "delete" ? "delete" : mode === "upsert" ? "upsert" : "query";
+ return `POST /v2/vectordb/entities/${endpoint}\n${JSON.stringify(body, null, 2)}`;
+ }
+ const collectionPath = pathSegment(collection);
+ if (mode === "delete") {
+ return `POST /collections/${collectionPath}/points/delete?wait=true\n${JSON.stringify({ points: [1] }, null, 2)}`;
+ }
+ if (mode === "upsert") {
+ return `PUT /collections/${collectionPath}/points?wait=true\n${JSON.stringify(
+ {
+ points: [
+ {
+ id: 1,
+ vector: [0.1, 0.2, 0.3, 0.4],
+ payload: {
+ title: "updated vector",
+ kind: "demo",
+ },
+ },
+ ],
+ },
+ null,
+ 2,
+ )}`;
+ }
+ return `POST /collections/${collectionPath}/points/scroll\n${JSON.stringify({ limit: 100, with_payload: true, with_vector: false }, null, 2)}`;
+}
+
+function startTimer() {
+ stopTimer();
+ const startedAt = Date.now();
+ elapsedSeconds.value = "0.0";
+ loadingTimer = setInterval(() => {
+ elapsedSeconds.value = ((Date.now() - startedAt) / 1000).toFixed(1);
+ }, 100);
+}
+
+function stopTimer() {
+ if (loadingTimer) clearInterval(loadingTimer);
+ loadingTimer = undefined;
+}
+
+function firstResult(results: QueryResult[]): QueryResult {
+ return results.find((item) => item.columns.length > 0) ?? results[0] ?? emptyResult();
+}
+
+async function executeRequestText(text: string): Promise<QueryResult> {
+ const results = await api.executeMulti(props.connectionId, props.database || "default", text, undefined, executionId.value);
+ return firstResult(results);
+}
+
+async function refreshResult() {
+ if (loading.value) return;
+ const id = uuid();
+ executionId.value = id;
+ loading.value = true;
+ cancelling.value = false;
+ error.value = "";
+ statusMessage.value = "";
+ startTimer();
+ try {
+ const browseText = defaultRequestText(props.databaseType, props.database, props.collection, "browse");
+ const nextResult = await executeRequestText(browseText);
+ if (executionId.value === id) result.value = nextResult;
+ } catch (e: unknown) {
+ if (executionId.value === id) error.value = e instanceof Error ? e.message : String(e);
+ } finally {
+ if (executionId.value === id) {
+ loading.value = false;
+ stopTimer();
+ }
+ }
+}
+
+async function runRequest() {
+ if (loading.value) return;
+ const id = uuid();
+ executionId.value = id;
+ loading.value = true;
+ cancelling.value = false;
+ error.value = "";
+ statusMessage.value = "";
+ startTimer();
+ try {
+ const nextResult = await executeRequestText(requestText.value);
+ if (executionId.value !== id) return;
+ if (operationMode.value === "browse") {
+ result.value = nextResult;
+ } else {
+ const browseText = defaultRequestText(props.databaseType, props.database, props.collection, "browse");
+ result.value = await executeRequestText(browseText);
+ statusMessage.value = t("vector.operationSuccess");
+ }
+ } catch (e: unknown) {
+ if (executionId.value === id) error.value = e instanceof Error ? e.message : String(e);
+ } finally {
+ if (executionId.value === id) {
+ loading.value = false;
+ stopTimer();
+ }
+ }
+}
+
+async function cancelRequest() {
+ if (!executionId.value) return;
+ cancelling.value = true;
+ await api.cancelQuery(executionId.value).catch(() => false);
+}
+
+function resetRequest() {
+ requestText.value = defaultRequestText(props.databaseType, props.database, props.collection, operationMode.value);
+}
+
+function setOperationMode(mode: VectorOperationMode) {
+ if (operationMode.value === mode) return;
+ operationMode.value = mode;
+ resetRequest();
+ error.value = "";
+ statusMessage.value = "";
+}
+</script>
+
+<template>
+ <div class="flex h-full min-h-0 flex-col bg-background">
+ <div class="flex shrink-0 items-center justify-between gap-3 border-b px-3 py-2">
+ <div class="min-w-0">
+ <div class="truncate text-sm font-semibold">{{ collectionLabel }}</div>
+ <div class="truncate text-xs text-muted-foreground">{{ t("vector.productCollection", { product: productLabel }) }}</div>
+ </div>
+ <div class="flex shrink-0 items-center gap-1.5">
+ <div class="mr-1 flex h-7 overflow-hidden rounded-md border bg-muted/30 p-0.5">
+ <button type="button" class="h-6 px-2 text-xs transition-colors" :class="operationMode === 'browse' ? 'rounded bg-background font-medium shadow-sm' : 'text-muted-foreground hover:text-foreground'" :disabled="loading" @click="setOperationMode('browse')">{{ t("vector.browse") }}</button>
+ <button type="button" class="h-6 px-2 text-xs transition-colors" :class="operationMode === 'upsert' ? 'rounded bg-background font-medium shadow-sm' : 'text-muted-foreground hover:text-foreground'" :disabled="loading" @click="setOperationMode('upsert')">{{ t("vector.upsert") }}</button>
+ <button type="button" class="h-6 px-2 text-xs transition-colors" :class="operationMode === 'delete' ? 'rounded bg-background font-medium shadow-sm' : 'text-muted-foreground hover:text-foreground'" :disabled="loading" @click="setOperationMode('delete')">{{ t("vector.delete") }}</button>
+ </div>
+ <Button variant="outline" size="sm" class="h-7 gap-1.5 px-2" :disabled="loading" @click="resetRequest">
+ <RotateCcw class="h-3.5 w-3.5" />
+ {{ t("vector.reset") }}
+ </Button>
+ <Button variant="outline" size="sm" class="h-7 gap-1.5 px-2" :disabled="loading" @click="refreshResult">
+ <RefreshCcw class="h-3.5 w-3.5" />
+ {{ t("vector.refresh") }}
+ </Button>
+ <Button size="sm" class="h-7 gap-1.5 px-2" :disabled="loading || !requestText.trim()" @click="runRequest">
+ <component :is="operationIcon" class="h-3.5 w-3.5" />
+ {{ executeLabel }}
+ </Button>
+ </div>
+ </div>
+
+ <div class="grid min-h-0 flex-1 grid-rows-[minmax(9rem,15rem)_1fr]">
+ <div class="min-h-0 border-b">
+ <textarea v-model="requestText" class="dbx-editor-font-family h-full w-full resize-none bg-background px-3 py-2 text-xs leading-5 outline-none" :aria-label="t('vector.requestEditor')" spellcheck="false" autocomplete="off" autocapitalize="off" autocorrect="off" />
+ </div>
+ <div class="min-h-0">
+ <ErrorBanner v-if="error" :message="error" copy-mode="label" dismissible @dismiss="error = ''" />
+ <div v-else-if="statusMessage" class="border-b bg-emerald-50 px-3 py-1.5 text-xs text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-300">{{ statusMessage }}</div>
+ <QueryLoadingState v-if="loading && result.columns.length === 0" class="h-full" label-key="editor.fetching" :elapsed-seconds="elapsedSeconds" show-cancel :cancel-disabled="!executionId || cancelling" :cancelling="cancelling" @cancel="cancelRequest" />
+ <DataGrid v-else class="h-full" :result="result" context="results" :sql="requestText" :loading="loading" @reload="refreshResult" />
+ </div>
+ </div>
+ </div>
+</template>
diff --git a/apps/desktop/src/composables/useNavigationTargets.ts b/apps/desktop/src/composables/useNavigationTargets.ts
index 0d49e7e0a5..f23fc60ad7 100644
--- a/apps/desktop/src/composables/useNavigationTargets.ts
+++ b/apps/desktop/src/composables/useNavigationTargets.ts
@@ -25,6 +25,12 @@ async function openTableTarget(target: NavigationTarget, options: { tableInfoTab
connectionStore.activeConnectionId = target.connectionId;
const config = connectionStore.getConfig(target.connectionId);
const tabTitle = target.schema ? `${target.schema}.${target.tableName}` : target.tableName;
+ if (config?.db_type === "qdrant" || config?.db_type === "milvus") {
+ await connectionStore.ensureConnected(target.connectionId);
+ const tabId = queryStore.createTab(target.connectionId, target.database || "default", tabTitle, "vector");
+ queryStore.updateSql(tabId, target.tableName);
+ return;
+ }
const tabId = (() => {
if (settingsStore.editorSettings.reuseDataTab) {
const existing = queryStore.tabs.find((tab) => tab.mode === "data" && tab.connectionId === target.connectionId && tab.database === target.database);
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 882a76e8d3..16948a1875 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -442,6 +442,7 @@ export default {
redis: "Redis",
etcd: "etcd",
mongo: "Mongo",
+ vector: "Vector",
objects: "Objects",
users: "Users & Privileges",
executionSummary: "Execution Summary",
@@ -1592,6 +1593,19 @@ export default {
filterPlaceholder: "Filter...",
sortPlaceholder: "Sort...",
},
+ vector: {
+ collectionFallback: "collection",
+ productCollection: "{product} collection",
+ browse: "Browse",
+ upsert: "Upsert",
+ delete: "Delete",
+ reset: "Reset",
+ refresh: "Refresh",
+ run: "Run",
+ apply: "Apply",
+ requestEditor: "Vector request editor",
+ operationSuccess: "Operation completed. The collection preview has been refreshed.",
+ },
history: {
title: "History",
search: "Search history...",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index cb44b1b191..b768a380c2 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -443,6 +443,7 @@ export default {
redis: "Redis",
etcd: "etcd",
mongo: "Mongo",
+ vector: "向量",
objects: "对象",
users: "用户与权限",
executionSummary: "执行摘要",
@@ -1591,6 +1592,19 @@ export default {
filterPlaceholder: "过滤条件...",
sortPlaceholder: "排序条件...",
},
+ vector: {
+ collectionFallback: "集合",
+ productCollection: "{product} 集合",
+ browse: "浏览",
+ upsert: "写入",
+ delete: "删除",
+ reset: "重置",
+ refresh: "刷新",
+ run: "运行",
+ apply: "应用",
+ requestEditor: "向量请求编辑器",
+ operationSuccess: "操作已完成,集合预览已刷新。",
+ },
history: {
title: "历史",
search: "搜索历史...",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 2a34404864..5c76c6e081 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -420,6 +420,7 @@ export default {
tableData: "資料表",
redis: "Redis",
mongo: "Mongo",
+ vector: "向量",
objects: "物件",
tooltipTitle: "標題:",
tooltipConnection: "連線:",
@@ -1434,6 +1435,19 @@ export default {
filterPlaceholder: "過濾條件……",
sortPlaceholder: "排序條件……",
},
+ vector: {
+ collectionFallback: "集合",
+ productCollection: "{product} 集合",
+ browse: "瀏覽",
+ upsert: "寫入",
+ delete: "刪除",
+ reset: "重設",
+ refresh: "重新整理",
+ run: "執行",
+ apply: "套用",
+ requestEditor: "向量請求編輯器",
+ operationSuccess: "操作已完成,集合預覽已重新整理。",
+ },
history: {
title: "歷史",
search: "搜尋歷史……",
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index 3c708ee398..dc37f376d9 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -338,6 +338,7 @@ export const mongoDeleteDocuments = forward("mongoDeleteDocuments");
// Elasticsearch
export const elasticsearchListIndices = forward("elasticsearchListIndices");
+export const vectorListCollections = forward("vectorListCollections");
// History
export const saveHistory = forward("saveHistory");
diff --git a/apps/desktop/src/lib/connectionPresentation.ts b/apps/desktop/src/lib/connectionPresentation.ts
index c876878e65..068251fe3a 100644
--- a/apps/desktop/src/lib/connectionPresentation.ts
+++ b/apps/desktop/src/lib/connectionPresentation.ts
@@ -127,6 +127,8 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
return "oracle://user:password@host:port/service_name";
case "elasticsearch":
+ case "qdrant":
+ case "milvus":
return "http://user:password@host:port";
case "dameng":
diff --git a/apps/desktop/src/lib/connectionUrl.ts b/apps/desktop/src/lib/connectionUrl.ts
index 7c4454317b..f76b5d4376 100644
--- a/apps/desktop/src/lib/connectionUrl.ts
+++ b/apps/desktop/src/lib/connectionUrl.ts
@@ -39,6 +39,8 @@ const SCHEME_PROFILES: Record<string, ConnectionProfile> = {
mssql: { type: "sqlserver", profile: "sqlserver", label: "SQL Server", defaultPort: 1433 },
oracle: { type: "oracle", profile: "oracle", label: "Oracle", defaultPort: 1521 },
elasticsearch: { type: "elasticsearch", profile: "elasticsearch", label: "Elasticsearch", defaultPort: 9200 },
+ qdrant: { type: "qdrant", profile: "qdrant", label: "Qdrant", defaultPort: 6333 },
+ milvus: { type: "milvus", profile: "milvus", label: "Milvus", defaultPort: 19530 },
dm: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 },
dameng: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 },
gaussdb: { type: "gaussdb", profile: "gaussdb", label: "GaussDB", defaultPort: 5432 },
@@ -59,6 +61,8 @@ const SCHEME_PROFILES: Record<string, ConnectionProfile> = {
const HTTP_SELECTED_PROFILES: Record<string, ConnectionProfile> = {
clickhouse: SCHEME_PROFILES.clickhouse,
elasticsearch: SCHEME_PROFILES.elasticsearch,
+ qdrant: SCHEME_PROFILES.qdrant,
+ milvus: SCHEME_PROFILES.milvus,
};
function decodeUrlPart(value: string): string {
diff --git a/apps/desktop/src/lib/connectionVisibleDatabases.ts b/apps/desktop/src/lib/connectionVisibleDatabases.ts
index 2c4f6dedfd..da7a6d6841 100644
--- a/apps/desktop/src/lib/connectionVisibleDatabases.ts
+++ b/apps/desktop/src/lib/connectionVisibleDatabases.ts
@@ -3,7 +3,7 @@ import { filterDatabaseNamesForConnection, normalizeVisibleDatabaseSelection } f
const DRAFT_VISIBLE_DATABASES_PREFIX = "__visible_draft_";
-const UNSUPPORTED_VISIBLE_DATABASE_TYPES = new Set<DatabaseType>(["elasticsearch", "etcd"]);
+const UNSUPPORTED_VISIBLE_DATABASE_TYPES = new Set<DatabaseType>(["elasticsearch", "qdrant", "milvus", "etcd"]);
type VisibleDatabaseConnectionFields = Pick<
ConnectionConfig,
diff --git a/apps/desktop/src/lib/http.ts b/apps/desktop/src/lib/http.ts
index bddd6bc449..dce983178d 100644
--- a/apps/desktop/src/lib/http.ts
+++ b/apps/desktop/src/lib/http.ts
@@ -1460,6 +1460,10 @@ export async function elasticsearchListIndices(connectionId: string): Promise<st
return mongoListCollections(connectionId, "default");
}
+export async function vectorListCollections(connectionId: string): Promise<string[]> {
+ return mongoListCollections(connectionId, "default");
+}
+
export async function mongoFindDocuments(connectionId: string, database: string, collection: string, skip: number, limit: number, filter?: string, sort?: string, executionId?: string): Promise<MongoDocumentResult> {
return post("/api/mongo/find-documents", { connectionId, database, collection, skip, limit, filter, sort, executionId });
}
diff --git a/apps/desktop/src/lib/sidebarActiveTabTarget.ts b/apps/desktop/src/lib/sidebarActiveTabTarget.ts
index c12a83c179..eafe9530b9 100644
--- a/apps/desktop/src/lib/sidebarActiveTabTarget.ts
+++ b/apps/desktop/src/lib/sidebarActiveTabTarget.ts
@@ -15,6 +15,11 @@ export type ActiveTabSidebarTarget =
database: string;
collectionName: string;
}
+ | {
+ type: "vector-collection";
+ connectionId: string;
+ collectionName: string;
+ }
| {
type: "etcd-root";
connectionId: string;
@@ -61,6 +66,16 @@ export function activeTabSidebarTarget(tab: QueryTab | undefined | null): Active
};
}
+ if (tab.mode === "vector") {
+ const collectionName = tab.sql || tab.title;
+ if (!collectionName) return null;
+ return {
+ type: "vector-collection",
+ connectionId: tab.connectionId,
+ collectionName,
+ };
+ }
+
if (tab.mode === "etcd") {
return { type: "etcd-root", connectionId: tab.connectionId };
}
@@ -99,6 +114,10 @@ export function matchesTarget(node: TreeNode, target: ActiveTabSidebarTarget): b
return node.type === "mongo-collection" && node.connectionId === target.connectionId && node.database === target.database && node.label === target.collectionName;
}
+ if (target.type === "vector-collection") {
+ return node.type === "vector-collection" && node.connectionId === target.connectionId && node.label === target.collectionName;
+ }
+
if (target.type === "query-context") {
if (target.schema) {
return node.type === "schema" && node.connectionId === target.connectionId && node.database === target.database && node.label === target.schema;
diff --git a/apps/desktop/src/lib/sidebarNodeOrdering.ts b/apps/desktop/src/lib/sidebarNodeOrdering.ts
index 33f570d854..8cb54425b0 100644
--- a/apps/desktop/src/lib/sidebarNodeOrdering.ts
+++ b/apps/desktop/src/lib/sidebarNodeOrdering.ts
@@ -30,7 +30,7 @@ export function sortSidebarTreeChildrenForParent(parent: Pick<TreeNode, "type">,
const regularChildren = normalized.filter((child) => child.type !== "user-admin" && child.type !== "saved-sql-root");
const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...userAdminNodes];
- if (databaseType === "mongodb" || databaseType === "elasticsearch") {
+ if (databaseType === "mongodb" || databaseType === "elasticsearch" || databaseType === "qdrant" || databaseType === "milvus") {
return withConnectionUtilityOrder(sortByLabel(regularChildren));
}
diff --git a/apps/desktop/src/lib/sidebarTreeItemLayout.ts b/apps/desktop/src/lib/sidebarTreeItemLayout.ts
index cf9ee9e887..9cf688fdd6 100644
--- a/apps/desktop/src/lib/sidebarTreeItemLayout.ts
+++ b/apps/desktop/src/lib/sidebarTreeItemLayout.ts
@@ -1,8 +1,8 @@
import type { TreeNodeType } from "@/types/database";
-const leafTypes: Set<TreeNodeType> = new Set(["column", "index", "fkey", "trigger", "procedure", "function", "package", "package-body", "object-browser", "redis-db", "mq-tenant", "mongo-collection", "elasticsearch-index", "user-admin", "saved-sql-file", "load-more"]);
+const leafTypes: Set<TreeNodeType> = new Set(["column", "index", "fkey", "trigger", "procedure", "function", "package", "package-body", "object-browser", "redis-db", "mq-tenant", "mongo-collection", "vector-collection", "elasticsearch-index", "user-admin", "saved-sql-file", "load-more"]);
-const fullWidthLabelTypes: Set<TreeNodeType> = new Set(["table", "view", "materialized_view", "mongo-collection", "elasticsearch-index"]);
+const fullWidthLabelTypes: Set<TreeNodeType> = new Set(["table", "view", "materialized_view", "mongo-collection", "vector-collection", "elasticsearch-index"]);
const emptyContainerTypes: Set<TreeNodeType> = new Set(["saved-sql-root", "saved-sql-folder"]);
diff --git a/apps/desktop/src/lib/sqlSemanticDiagnostics.ts b/apps/desktop/src/lib/sqlSemanticDiagnostics.ts
index 407b31c7d5..8ce38b1cad 100644
--- a/apps/desktop/src/lib/sqlSemanticDiagnostics.ts
+++ b/apps/desktop/src/lib/sqlSemanticDiagnostics.ts
@@ -80,7 +80,7 @@ export function areSqlSemanticDiagnosticsEqual(left: readonly SqlSemanticDiagnos
}
export function shouldRunSqlSemanticDiagnostics(sql: string, cursor: number, options: { databaseType?: DatabaseType } = {}): boolean {
- if (options.databaseType === "mongodb" || options.databaseType === "elasticsearch" || options.databaseType === "redis") return false;
+ if (options.databaseType === "mongodb" || options.databaseType === "elasticsearch" || options.databaseType === "qdrant" || options.databaseType === "milvus" || options.databaseType === "redis") return false;
const context = getSqlCompletionContext(sql, cursor);
if (context.suggestTables || context.exclusiveTableSuggestions || context.exclusiveColumnSuggestions) return false;
if (context.qualifier) return false;
diff --git a/apps/desktop/src/lib/tabPresentation.ts b/apps/desktop/src/lib/tabPresentation.ts
index 4fccaacf97..d1736aea22 100644
--- a/apps/desktop/src/lib/tabPresentation.ts
+++ b/apps/desktop/src/lib/tabPresentation.ts
@@ -70,6 +70,10 @@ export function tabDisplayTitle(tab: QueryTab, t: Translate): string {
if (compact) return tab.sql;
return `${tab.sql}@${database}`;
}
+ if (tab.mode === "vector" && tab.sql) {
+ if (compact) return tab.sql;
+ return `${tab.sql}@${database}`;
+ }
if (tab.mode === "redis") {
if (compact) return connectionDisplayName(tab.connectionId);
return `${connectionDisplayName(tab.connectionId)}@${database}`;
@@ -106,6 +110,9 @@ export function tabTooltipLines(tab: QueryTab, t: Translate): { label: string; v
if (tab.mode === "mongo" && tab.sql) {
lines.push({ label: t("tabs.tooltipCollection"), value: tab.sql });
}
+ if (tab.mode === "vector" && tab.sql) {
+ lines.push({ label: t("tabs.tooltipCollection"), value: tab.sql });
+ }
if (tab.mode === "objects" && tab.objectBrowser?.schema) {
lines.push({ label: t("tabs.tooltipSchema"), value: tab.objectBrowser.schema });
}
@@ -171,6 +178,7 @@ export function tabModeLabel(tab: QueryTab, t: Translate): string {
if (tab.mode === "data") return t("tabs.table");
if (tab.mode === "query") return t("tabs.sql");
if (tab.mode === "mongo") return t("tabs.mongo");
+ if (tab.mode === "vector") return t("tabs.vector");
if (tab.mode === "redis") return t("tabs.redis");
if (tab.mode === "etcd") return t("tabs.etcd");
if (tab.mode === "objects") return t("tabs.objects");
diff --git a/apps/desktop/src/lib/tableMetadataCapabilities.ts b/apps/desktop/src/lib/tableMetadataCapabilities.ts
index be51a38039..b51e32471a 100644
--- a/apps/desktop/src/lib/tableMetadataCapabilities.ts
+++ b/apps/desktop/src/lib/tableMetadataCapabilities.ts
@@ -31,6 +31,18 @@ const capabilityByType: Partial<Record<DatabaseType, Partial<TableMetadataCapabi
triggers: false,
ddl: false,
},
+ qdrant: {
+ indexes: false,
+ foreignKeys: false,
+ triggers: false,
+ ddl: false,
+ },
+ milvus: {
+ indexes: false,
+ foreignKeys: false,
+ triggers: false,
+ ddl: false,
+ },
influxdb: {
indexes: false,
foreignKeys: false,
diff --git a/apps/desktop/src/lib/tauri.ts b/apps/desktop/src/lib/tauri.ts
index 96aab80845..02b9a4a6a0 100644
--- a/apps/desktop/src/lib/tauri.ts
+++ b/apps/desktop/src/lib/tauri.ts
@@ -1300,6 +1300,10 @@ export async function elasticsearchListIndices(connectionId: string): Promise<st
return mongoListCollections(connectionId, "default");
}
+export async function vectorListCollections(connectionId: string): Promise<string[]> {
+ return mongoListCollections(connectionId, "default");
+}
+
export async function mongoFindDocuments(connectionId: string, database: string, collection: string, skip: number, limit: number, filter?: string, sort?: string, executionId?: string): Promise<MongoDocumentResult> {
return invoke("mongo_find_documents", { connectionId, database, collection, skip, limit, filter, sort, executionId });
}
diff --git a/apps/desktop/src/lib/treeNodeClick.ts b/apps/desktop/src/lib/treeNodeClick.ts
index 4e4639cafb..66489d2777 100644
--- a/apps/desktop/src/lib/treeNodeClick.ts
+++ b/apps/desktop/src/lib/treeNodeClick.ts
@@ -7,7 +7,7 @@ export type SidebarSelectionCopyAction = "copy-name" | "none";
export type SidebarActivation = "single" | "double";
const dataNodeTypes = new Set<TreeNodeType>(["table", "view", "materialized_view"]);
-const toggleLeafNodeTypes = new Set<TreeNodeType>(["redis-db", "mq-tenant", "mongo-collection", "elasticsearch-index", "user-admin"]);
+const toggleLeafNodeTypes = new Set<TreeNodeType>(["redis-db", "mq-tenant", "mongo-collection", "vector-collection", "elasticsearch-index", "user-admin"]);
const objectBrowserNodeTypes = new Set<TreeNodeType>(["database", "schema", "object-browser"]);
const sourceNodeTypes = new Set<TreeNodeType>(["materialized_view", "procedure", "function", "sequence", "package", "package-body"]);
const savedSqlNodeTypes = new Set<TreeNodeType>(["saved-sql-file"]);
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 2cde76187c..715ff706c6 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -293,6 +293,8 @@ export const useConnectionStore = defineStore("connection", () => {
mongodb: "MongoDB",
oracle: "Oracle",
elasticsearch: "Elasticsearch",
+ qdrant: "Qdrant",
+ milvus: "Milvus",
doris: "Doris",
starrocks: "StarRocks",
manticoresearch: "Manticore Search",
@@ -788,6 +790,8 @@ export const useConnectionStore = defineStore("connection", () => {
await loadMongoDatabases(connectionId);
} else if (config.db_type === "elasticsearch") {
await loadElasticsearchIndices(connectionId);
+ } else if (config.db_type === "qdrant" || config.db_type === "milvus") {
+ await loadVectorCollections(connectionId);
} else if (config.db_type === "mq") {
await loadMqTenants(connectionId, { force: true });
} else {
@@ -1198,7 +1202,7 @@ export const useConnectionStore = defineStore("connection", () => {
withSavedSqlRoot(
connectionId,
sortSidebarNames(indices).map((index) => ({
- id: `${connectionId}:__es_index:${index}`,
+ id: `${connectionId}:__collection:${index}`,
label: index,
type: "elasticsearch-index" as const,
connectionId,
@@ -1217,6 +1221,38 @@ export const useConnectionStore = defineStore("connection", () => {
}
}
+ async function loadVectorCollections(connectionId: string) {
+ const node = findNode(treeNodes.value, connectionId);
+ if (!node) return;
+
+ node.isLoading = true;
+ try {
+ await ensureConnected(connectionId);
+ const collections = await api.vectorListCollections(connectionId);
+ setChildren(
+ node,
+ withSavedSqlRoot(
+ connectionId,
+ sortSidebarNames(collections).map((collection) => ({
+ id: `${connectionId}:__vector_collection:${collection}`,
+ label: collection,
+ type: "vector-collection" as const,
+ connectionId,
+ database: "default",
+ isExpanded: false,
+ })),
+ node,
+ ),
+ );
+ node.isExpanded = true;
+ } catch (e) {
+ recordMetadataLoadError(connectionId, e);
+ throw e;
+ } finally {
+ node.isLoading = false;
+ }
+ }
+
async function loadMongoCollections(connectionId: string, database: string) {
const nodeId = `${connectionId}:${database}`;
const node = findNode(treeNodes.value, nodeId);
@@ -1822,6 +1858,8 @@ export const useConnectionStore = defineStore("connection", () => {
await loadMongoDatabases(node.connectionId);
} else if (config?.db_type === "elasticsearch") {
await loadElasticsearchIndices(node.connectionId);
+ } else if (config?.db_type === "qdrant" || config?.db_type === "milvus") {
+ await loadVectorCollections(node.connectionId);
} else if (config?.db_type === "mq") {
await loadMqTenants(node.connectionId, options);
} else {
@@ -2967,6 +3005,7 @@ export const useConnectionStore = defineStore("connection", () => {
updateRedisDbKeyStats,
loadMongoDatabases,
loadElasticsearchIndices,
+ loadVectorCollections,
loadMongoCollections,
loadSchemas,
loadSqlServerDatabaseObjects,
diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts
index 72bc088923..a17b0ece0f 100644
--- a/apps/desktop/src/types/database.ts
+++ b/apps/desktop/src/types/database.ts
@@ -11,6 +11,8 @@ export type DatabaseType =
| "mongodb"
| "oracle"
| "elasticsearch"
+ | "qdrant"
+ | "milvus"
| "doris"
| "starrocks"
| "manticoresearch"
@@ -438,6 +440,7 @@ export type TreeNodeType =
| "etcd-root"
| "mongo-db"
| "mongo-collection"
+ | "vector-collection"
| "elasticsearch-index";
export interface ConnectionGroup {
@@ -540,7 +543,7 @@ export interface QueryTab {
executionId?: string;
isExplaining?: boolean;
explainExecutionId?: string;
- mode: "data" | "query" | "redis" | "mongo" | "etcd" | "mq" | "objects" | "structure" | "users";
+ mode: "data" | "query" | "redis" | "mongo" | "vector" | "etcd" | "mq" | "objects" | "structure" | "users";
mqTenant?: string;
structureTableName?: string;
objectBrowser?: {
diff --git a/crates/dbx-core/assets/database-drivers.manifest.json b/crates/dbx-core/assets/database-drivers.manifest.json
index 3fd753d820..5029466a1e 100644
--- a/crates/dbx-core/assets/database-drivers.manifest.json
+++ b/crates/dbx-core/assets/database-drivers.manifest.json
@@ -320,6 +320,64 @@
"driverManagement": false
}
},
+ {
+ "dbType": "qdrant",
+ "label": "Qdrant",
+ "runtimeMode": "native",
+ "mcpMode": "bridge",
+ "singleConnectionPool": false,
+ "metadataConnectionScoped": false,
+ "skipTcpProbe": false,
+ "defaultPort": 6333,
+ "supportLevel": "browse",
+ "capabilities": {
+ "queryExecution": true,
+ "metadataBrowse": true,
+ "objectBrowser": false,
+ "objectSource": false,
+ "schemaSearch": false,
+ "diagram": false,
+ "tableDataEdit": false,
+ "tableStructureEdit": false,
+ "tableImport": false,
+ "dataTransfer": false,
+ "sqlFileExecution": false,
+ "databaseCreate": false,
+ "fieldLineage": false,
+ "sqlExplain": false,
+ "userAdmin": false,
+ "driverManagement": false
+ }
+ },
+ {
+ "dbType": "milvus",
+ "label": "Milvus",
+ "runtimeMode": "native",
+ "mcpMode": "bridge",
+ "singleConnectionPool": false,
+ "metadataConnectionScoped": false,
+ "skipTcpProbe": false,
+ "defaultPort": 19530,
+ "supportLevel": "browse",
+ "capabilities": {
+ "queryExecution": true,
+ "metadataBrowse": true,
+ "objectBrowser": false,
+ "objectSource": false,
+ "schemaSearch": false,
+ "diagram": false,
+ "tableDataEdit": false,
+ "tableStructureEdit": false,
+ "tableImport": false,
+ "dataTransfer": false,
+ "sqlFileExecution": false,
+ "databaseCreate": false,
+ "fieldLineage": false,
+ "sqlExplain": false,
+ "userAdmin": false,
+ "driverManagement": false
+ }
+ },
{
"dbType": "doris",
"label": "Doris",
diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs
index 100046b760..b09b91034d 100644
--- a/crates/dbx-core/src/connection.rs
+++ b/crates/dbx-core/src/connection.rs
@@ -67,6 +67,7 @@ pub enum PoolKind {
ClickHouse(db::clickhouse_driver::ChClient),
SqlServer(Arc<tokio::sync::Mutex<db::sqlserver::SqlServerClient>>),
Elasticsearch(db::elasticsearch_driver::EsClient),
+ VectorDb(db::vector_driver::VectorClient),
InfluxDb(db::influxdb_driver::InfluxdbClient),
Agent(Arc<tokio::sync::Mutex<db::agent_driver::AgentDriverClient>>),
ExternalTabular(ExternalTabularHandle),
@@ -601,6 +602,23 @@ impl AppState {
db::elasticsearch_driver::test_connection(&mut client, connect_timeout).await?;
PoolKind::Elasticsearch(client)
}
+ DatabaseType::Qdrant | DatabaseType::Milvus => {
+ let kind = match db_config.db_type {
+ DatabaseType::Qdrant => db::vector_driver::VectorDbKind::Qdrant,
+ DatabaseType::Milvus => db::vector_driver::VectorDbKind::Milvus,
+ _ => unreachable!(),
+ };
+ let client = db::vector_driver::VectorClient::new(
+ kind,
+ &url,
+ Some(&db_config.username),
+ Some(&db_config.password),
+ db_config.ssl,
+ connect_timeout,
+ );
+ db::vector_driver::test_connection(&client, connect_timeout).await?;
+ PoolKind::VectorDb(client)
+ }
DatabaseType::InfluxDb => {
let username = if db_config.username.is_empty() { None } else { Some(db_config.username.clone()) };
let password = if db_config.password.is_empty() { None } else { Some(db_config.password.clone()) };
@@ -1292,6 +1310,7 @@ enum KeepaliveTarget {
ClickHouse(db::clickhouse_driver::ChClient),
SqlServer(Arc<tokio::sync::Mutex<db::sqlserver::SqlServerClient>>),
Elasticsearch(db::elasticsearch_driver::EsClient),
+ VectorDb(db::vector_driver::VectorClient),
InfluxDb(db::influxdb_driver::InfluxdbClient),
}
@@ -1308,6 +1327,7 @@ fn keepalive_target_from_pool(pool: &PoolKind, config: &ConnectionConfig) -> Opt
PoolKind::ClickHouse(client) => Some(KeepaliveTarget::ClickHouse(client.clone())),
PoolKind::SqlServer(client) => Some(KeepaliveTarget::SqlServer(client.clone())),
PoolKind::Elasticsearch(client) => Some(KeepaliveTarget::Elasticsearch(client.clone())),
+ PoolKind::VectorDb(client) => Some(KeepaliveTarget::VectorDb(client.clone())),
PoolKind::InfluxDb(client) => Some(KeepaliveTarget::InfluxDb(client.clone())),
_ => None,
}
@@ -1334,6 +1354,7 @@ async fn ping_keepalive_target(target: &mut KeepaliveTarget, timeout: Duration)
db::sqlserver::test_connection(&mut client).await
}
KeepaliveTarget::Elasticsearch(client) => db::elasticsearch_driver::test_connection(client, timeout).await,
+ KeepaliveTarget::VectorDb(client) => db::vector_driver::test_connection(client, timeout).await,
KeepaliveTarget::InfluxDb(client) => db::influxdb_driver::test_connection(client, timeout).await,
}
}
@@ -1452,6 +1473,7 @@ pub async fn close_pool_kind(pool: PoolKind) {
PoolKind::ClickHouse(_) => {}
PoolKind::SqlServer(_) => {}
PoolKind::Elasticsearch(_) => {}
+ PoolKind::VectorDb(_) => {}
PoolKind::InfluxDb(_) => {}
PoolKind::Agent(client) => {
let mut client = client.lock().await;
@@ -1510,7 +1532,8 @@ fn base_pool_key_for(
) -> String {
let is_single_connection_pool = db_type.as_ref().is_some_and(|db_type| {
let is_single = database_capabilities::is_single_connection_pool(db_type)
- || (include_elasticsearch_single_pool && *db_type == DatabaseType::Elasticsearch);
+ || (include_elasticsearch_single_pool
+ && matches!(db_type, DatabaseType::Elasticsearch | DatabaseType::Qdrant | DatabaseType::Milvus));
is_single && (!database_capabilities::is_agent_type(db_type) || shares_database_pool_with_connection(db_type))
});
diff --git a/crates/dbx-core/src/db/mod.rs b/crates/dbx-core/src/db/mod.rs
index c15b36f7a0..2654a4b198 100644
--- a/crates/dbx-core/src/db/mod.rs
+++ b/crates/dbx-core/src/db/mod.rs
@@ -19,6 +19,7 @@ pub mod sqlserver;
pub mod ssh_tunnel;
pub mod transport_layer_tunnel;
pub mod turso_driver;
+pub mod vector_driver;
pub mod wkb;
use reqwest::ClientBuilder;
diff --git a/crates/dbx-core/src/db/vector_driver.rs b/crates/dbx-core/src/db/vector_driver.rs
new file mode 100644
index 0000000000..8565f0a760
--- /dev/null
+++ b/crates/dbx-core/src/db/vector_driver.rs
@@ -0,0 +1,408 @@
+use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
+use reqwest::Client as HttpClient;
+use serde_json::{Map, Value};
+use std::error::Error;
+use std::time::{Duration, Instant};
+
+use super::{http_client_builder, with_connection_timeout};
+use crate::types::QueryResult;
+
+const PATH_SEGMENT_ENCODE_SET: &AsciiSet = &CONTROLS
+ .add(b' ')
+ .add(b'"')
+ .add(b'#')
+ .add(b'%')
+ .add(b'/')
+ .add(b'<')
+ .add(b'>')
+ .add(b'?')
+ .add(b'[')
+ .add(b'\\')
+ .add(b']')
+ .add(b'^')
+ .add(b'`')
+ .add(b'{')
+ .add(b'|')
+ .add(b'}');
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum VectorDbKind {
+ Qdrant,
+ Milvus,
+}
+
+impl VectorDbKind {
+ fn label(self) -> &'static str {
+ match self {
+ VectorDbKind::Qdrant => "Qdrant",
+ VectorDbKind::Milvus => "Milvus",
+ }
+ }
+}
+
+#[derive(Clone)]
+pub struct VectorClient {
+ kind: VectorDbKind,
+ http: HttpClient,
+ base_url: String,
+ auth: Option<VectorAuth>,
+}
+
+#[derive(Clone)]
+enum VectorAuth {
+ Basic(String, String),
+ Bearer(String),
+ ApiKey(String),
+}
+
+impl VectorClient {
+ pub fn new(
+ kind: VectorDbKind,
+ url: &str,
+ username: Option<&str>,
+ password: Option<&str>,
+ accept_invalid_certs: bool,
+ timeout: Duration,
+ ) -> Self {
+ let base_url = url.trim_end_matches('/').to_string();
+ let auth = vector_auth(kind, username, password);
+ let builder = http_client_builder(timeout).danger_accept_invalid_certs(accept_invalid_certs);
+ let http = builder.build().unwrap_or_else(|_| HttpClient::new());
+ Self { kind, http, base_url, auth }
+ }
+
+ fn get(&self, path: &str) -> reqwest::RequestBuilder {
+ self.with_auth(self.http.get(format!("{}{}", self.base_url, path)))
+ }
+
+ fn post(&self, path: &str) -> reqwest::RequestBuilder {
+ self.with_auth(self.http.post(format!("{}{}", self.base_url, path)))
+ }
+
+ fn put(&self, path: &str) -> reqwest::RequestBuilder {
+ self.with_auth(self.http.put(format!("{}{}", self.base_url, path)))
+ }
+
+ fn delete(&self, path: &str) -> reqwest::RequestBuilder {
+ self.with_auth(self.http.delete(format!("{}{}", self.base_url, path)))
+ }
+
+ fn with_auth(&self, req: reqwest::RequestBuilder) -> reqwest::RequestBuilder {
+ match &self.auth {
+ Some(VectorAuth::Basic(user, pass)) => req.basic_auth(user, Some(pass)),
+ Some(VectorAuth::Bearer(token)) => req.bearer_auth(token),
+ Some(VectorAuth::ApiKey(token)) => req.header("api-key", token),
+ None => req,
+ }
+ }
+}
+
+fn vector_auth(kind: VectorDbKind, username: Option<&str>, password: Option<&str>) -> Option<VectorAuth> {
+ let username = username.unwrap_or("").trim();
+ let password = password.unwrap_or("");
+ match kind {
+ VectorDbKind::Qdrant if !username.is_empty() => {
+ Some(VectorAuth::Basic(username.to_string(), password.to_string()))
+ }
+ VectorDbKind::Qdrant if !password.is_empty() => Some(VectorAuth::ApiKey(password.to_string())),
+ VectorDbKind::Qdrant => None,
+ VectorDbKind::Milvus if !username.is_empty() => Some(VectorAuth::Bearer(format!("{username}:{password}"))),
+ VectorDbKind::Milvus => None,
+ }
+}
+
+pub async fn test_connection(client: &VectorClient, timeout: Duration) -> Result<(), String> {
+ let label = client.kind.label();
+ let path = match client.kind {
+ VectorDbKind::Qdrant => "/collections",
+ VectorDbKind::Milvus => "/v2/vectordb/collections/list",
+ };
+ let request = match client.kind {
+ VectorDbKind::Qdrant => client.get(path),
+ VectorDbKind::Milvus => client.post(path).json(&serde_json::json!({ "dbName": "default" })),
+ };
+ let resp = with_connection_timeout(label, timeout, async {
+ request.send().await.map_err(|e| format!("{label} connection failed: {}", format_reqwest_error(&e)))
+ })
+ .await?;
+ ensure_success(label, resp).await.map(|_| ())
+}
+
+pub async fn list_collections(client: &VectorClient) -> Result<Vec<String>, String> {
+ match client.kind {
+ VectorDbKind::Qdrant => list_qdrant_collections(client).await,
+ VectorDbKind::Milvus => list_milvus_collections(client).await,
+ }
+}
+
+async fn list_qdrant_collections(client: &VectorClient) -> Result<Vec<String>, String> {
+ let body = send_json(client.get("/collections"), "Qdrant").await?;
+ let mut names: Vec<String> = body
+ .pointer("/result/collections")
+ .and_then(Value::as_array)
+ .into_iter()
+ .flatten()
+ .filter_map(|item| item.get("name").and_then(Value::as_str).map(str::to_string))
+ .collect();
+ names.sort();
+ Ok(names)
+}
+
+async fn list_milvus_collections(client: &VectorClient) -> Result<Vec<String>, String> {
+ let body = send_json(
+ client.post("/v2/vectordb/collections/list").json(&serde_json::json!({ "dbName": "default" })),
+ "Milvus",
+ )
+ .await?;
+ let mut names: Vec<String> = match body.get("data") {
+ Some(Value::Array(items)) => items.iter().filter_map(collection_name_from_milvus_item).collect(),
+ _ => Vec::new(),
+ };
+ names.sort();
+ Ok(names)
+}
+
+fn collection_name_from_milvus_item(item: &Value) -> Option<String> {
+ item.as_str()
+ .map(str::to_string)
+ .or_else(|| item.get("collectionName").and_then(Value::as_str).map(str::to_string))
+ .or_else(|| item.get("name").and_then(Value::as_str).map(str::to_string))
+}
+
+pub async fn find_documents(
+ client: &VectorClient,
+ collection: &str,
+ skip: u64,
+ limit: i64,
+) -> Result<crate::db::mongo_driver::MongoDocumentResult, String> {
+ let query = match client.kind {
+ VectorDbKind::Qdrant => format!(
+ "POST /collections/{}/points/scroll\n{}",
+ path_segment(collection),
+ serde_json::json!({
+ "limit": limit.max(1) as u64,
+ "offset": if skip == 0 { Value::Null } else { Value::from(skip) },
+ "with_payload": true,
+ "with_vector": false,
+ })
+ ),
+ VectorDbKind::Milvus => format!(
+ "POST /v2/vectordb/entities/query\n{}",
+ serde_json::json!({
+ "dbName": "default",
+ "collectionName": collection,
+ "filter": "",
+ "limit": limit.max(1) as u64,
+ "offset": skip,
+ "outputFields": ["*"],
+ })
+ ),
+ };
+ let result = execute_rest_query(client, &query).await?;
+ let documents = result
+ .rows
+ .into_iter()
+ .map(|row| {
+ let mut map = Map::new();
+ for (idx, column) in result.columns.iter().enumerate() {
+ map.insert(column.clone(), row.get(idx).cloned().unwrap_or(Value::Null));
+ }
+ Value::Object(map)
+ })
+ .collect();
+ Ok(crate::db::mongo_driver::MongoDocumentResult { documents, total: result.affected_rows })
+}
+
+pub async fn execute_rest_query(client: &VectorClient, input: &str) -> Result<QueryResult, String> {
+ let start = Instant::now();
+ let request = parse_rest_query(client, input)?;
+ let resp = request.send().await.map_err(|e| format!("{} request failed: {e}", client.kind.label()))?;
+ let status = resp.status().as_u16();
+ let body = resp.json::<Value>().await.unwrap_or(Value::Null);
+ if !(200..300).contains(&status) {
+ let detail = serde_json::to_string_pretty(&body).unwrap_or_else(|_| body.to_string());
+ return Err(format!("{} error ({status}): {detail}", client.kind.label()));
+ }
+ Ok(json_to_query_result(status, body, start))
+}
+
+fn parse_rest_query(client: &VectorClient, input: &str) -> Result<reqwest::RequestBuilder, String> {
+ let trimmed = input.trim();
+ if trimmed.is_empty() {
+ return Err(format!("{} query cannot be empty", client.kind.label()));
+ }
+
+ if !starts_with_http_method(trimmed) {
+ return default_collection_query(client, trimmed);
+ }
+
+ let (head, body) = trimmed.split_once('\n').map_or((trimmed, ""), |(head, body)| (head.trim(), body.trim()));
+ let mut parts = head.split_whitespace();
+ let method = parts.next().unwrap_or("").to_ascii_uppercase();
+ let path = parts.next().ok_or_else(|| "Vector query path is required".to_string())?;
+ let path = if path.starts_with('/') { path.to_string() } else { format!("/{path}") };
+ let req = match method.as_str() {
+ "GET" => client.get(&path),
+ "POST" => client.post(&path),
+ "PUT" => client.put(&path),
+ "DELETE" => client.delete(&path),
+ other => return Err(format!("Unsupported vector REST method: {other}")),
+ };
+ if body.is_empty() {
+ Ok(req)
+ } else {
+ let json: Value = serde_json::from_str(body).map_err(|e| format!("Vector query body must be JSON: {e}"))?;
+ Ok(req.json(&json))
+ }
+}
+
+fn default_collection_query(client: &VectorClient, collection: &str) -> Result<reqwest::RequestBuilder, String> {
+ let collection = collection.trim();
+ if collection.is_empty() {
+ return Err("Vector collection name cannot be empty".to_string());
+ }
+ match client.kind {
+ VectorDbKind::Qdrant => Ok(client
+ .post(&format!("/collections/{}/points/scroll", path_segment(collection)))
+ .json(&serde_json::json!({ "limit": 100, "with_payload": true, "with_vector": false }))),
+ VectorDbKind::Milvus => Ok(client.post("/v2/vectordb/entities/query").json(&serde_json::json!({
+ "dbName": "default",
+ "collectionName": collection,
+ "filter": "",
+ "limit": 100,
+ "outputFields": ["*"],
+ }))),
+ }
+}
+
+fn starts_with_http_method(input: &str) -> bool {
+ ["GET ", "POST ", "PUT ", "DELETE "].iter().any(|prefix| input.to_ascii_uppercase().starts_with(prefix))
+}
+
+fn path_segment(value: &str) -> String {
+ utf8_percent_encode(value, PATH_SEGMENT_ENCODE_SET).to_string()
+}
+
+async fn send_json(req: reqwest::RequestBuilder, label: &str) -> Result<Value, String> {
+ let resp = req.send().await.map_err(|e| format!("{label} request failed: {e}"))?;
+ let resp = ensure_success(label, resp).await?;
+ resp.json().await.map_err(|e| format!("{label} parse error: {e}"))
+}
+
+async fn ensure_success(label: &str, resp: reqwest::Response) -> Result<reqwest::Response, String> {
+ if resp.status().is_success() {
+ return Ok(resp);
+ }
+ let status = resp.status();
+ let body = resp.text().await.unwrap_or_default();
+ Err(format!("{label} error ({status}): {body}"))
+}
+
+fn json_to_query_result(status: u16, body: Value, start: Instant) -> QueryResult {
+ let rows_value =
+ body.pointer("/result/points").or_else(|| body.get("result")).or_else(|| body.get("data")).cloned();
+ if let Some(Value::Array(items)) = rows_value {
+ return values_to_query_result(items, start);
+ }
+ if let Some(Value::Array(items)) = body.pointer("/result/collections").cloned() {
+ return values_to_query_result(items, start);
+ }
+ QueryResult {
+ columns: vec!["status".to_string(), "response".to_string()],
+ column_types: Vec::new(),
+ column_sortables: vec![],
+ rows: vec![vec![
+ Value::Number(status.into()),
+ Value::String(serde_json::to_string_pretty(&body).unwrap_or_else(|_| body.to_string())),
+ ]],
+ affected_rows: 0,
+ execution_time_ms: start.elapsed().as_millis(),
+ truncated: false,
+ session_id: None,
+ has_more: false,
+ }
+}
+
+fn values_to_query_result(items: Vec<Value>, start: Instant) -> QueryResult {
+ let docs: Vec<Map<String, Value>> = items.into_iter().map(normalize_row_object).collect();
+ let mut columns = Vec::<String>::new();
+ for doc in &docs {
+ for key in doc.keys() {
+ if !columns.contains(key) {
+ columns.push(key.clone());
+ }
+ }
+ }
+ if columns.is_empty() {
+ columns.push("value".to_string());
+ }
+ let rows: Vec<Vec<Value>> = docs
+ .iter()
+ .map(|doc| columns.iter().map(|column| doc.get(column).cloned().unwrap_or(Value::Null)).collect())
+ .collect();
+ QueryResult {
+ columns,
+ column_types: Vec::new(),
+ column_sortables: vec![],
+ affected_rows: rows.len() as u64,
+ rows,
+ execution_time_ms: start.elapsed().as_millis(),
+ truncated: false,
+ session_id: None,
+ has_more: false,
+ }
+}
+
+fn normalize_row_object(value: Value) -> Map<String, Value> {
+ match value {
+ Value::Object(mut object) => {
+ if let Some(Value::Object(payload)) = object.remove("payload") {
+ for (key, value) in payload {
+ object.entry(key).or_insert(value);
+ }
+ }
+ object
+ }
+ other => {
+ let mut object = Map::new();
+ object.insert("value".to_string(), other);
+ object
+ }
+ }
+}
+
+fn format_reqwest_error(err: &reqwest::Error) -> String {
+ let mut parts = vec![err.to_string()];
+ let mut source = err.source();
+ while let Some(err) = source {
+ let text = err.to_string();
+ if !text.is_empty() && !parts.iter().any(|part| part == &text) {
+ parts.push(text);
+ }
+ source = err.source();
+ }
+ parts.join(": ")
+}
+
+#[cfg(test)]
+mod tests {
+ use super::{starts_with_http_method, values_to_query_result};
+ use serde_json::json;
+ use std::time::Instant;
+
+ #[test]
+ fn detects_rest_queries_case_insensitively() {
+ assert!(starts_with_http_method("post /collections/foo"));
+ assert!(starts_with_http_method("GET /collections"));
+ assert!(!starts_with_http_method("collection_name"));
+ }
+
+ #[test]
+ fn flattens_qdrant_payload_columns() {
+ let result =
+ values_to_query_result(vec![json!({"id": 1, "score": 0.9, "payload": {"title": "hello"}})], Instant::now());
+ assert!(result.columns.contains(&"id".to_string()));
+ assert!(result.columns.contains(&"score".to_string()));
+ assert!(result.columns.contains(&"title".to_string()));
+ }
+}
diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rs
index 9155febf0d..288f288290 100644
--- a/crates/dbx-core/src/models/connection.rs
+++ b/crates/dbx-core/src/models/connection.rs
@@ -254,6 +254,10 @@ pub enum DatabaseType {
Oracle,
#[serde(rename = "elasticsearch")]
Elasticsearch,
+ #[serde(rename = "qdrant")]
+ Qdrant,
+ #[serde(rename = "milvus")]
+ Milvus,
Doris,
#[serde(rename = "starrocks")]
StarRocks,
@@ -725,7 +729,7 @@ impl ConnectionConfig {
format!("mongodb://{host}:{port}{db_part}{suffix}")
}
DatabaseType::Oracle => format!("oracle://{host}:{port}{db_part}"),
- DatabaseType::Elasticsearch => {
+ DatabaseType::Elasticsearch | DatabaseType::Qdrant | DatabaseType::Milvus => {
let scheme = if self.ssl { "https" } else { "http" };
format!("{scheme}://{host}:{port}")
}
@@ -858,7 +862,7 @@ impl ConnectionConfig {
DatabaseType::Oracle => {
format!("oracle://{}:{}@{host}:{port}{db_part}", username, password)
}
- DatabaseType::Elasticsearch => {
+ DatabaseType::Elasticsearch | DatabaseType::Qdrant | DatabaseType::Milvus => {
let scheme = if self.ssl { "https" } else { "http" };
format!("{scheme}://{host}:{port}")
}
diff --git a/crates/dbx-core/src/mongo_ops.rs b/crates/dbx-core/src/mongo_ops.rs
index 4306c3bac3..281336fb5d 100644
--- a/crates/dbx-core/src/mongo_ops.rs
+++ b/crates/dbx-core/src/mongo_ops.rs
@@ -2,6 +2,7 @@ use crate::connection::{AppState, PoolKind};
use crate::db::agent_driver::mongo_document_id_params;
use crate::db::elasticsearch_driver;
use crate::db::mongo_driver::{self, MongoDocumentResult};
+use crate::db::vector_driver;
fn sort_names(mut names: Vec<String>) -> Vec<String> {
names.sort_by(|left, right| {
@@ -28,7 +29,7 @@ pub async fn mongo_list_databases_core(state: &AppState, connection_id: &str) ->
}
Err(error) => Err(error),
},
- PoolKind::Elasticsearch(_) => Ok(vec!["default".to_string()]),
+ PoolKind::Elasticsearch(_) | PoolKind::VectorDb(_) => Ok(vec!["default".to_string()]),
PoolKind::Agent(client) => {
let mut client = client.lock().await;
match client.mongo_list_databases::<Vec<serde_json::Value>>().await {
@@ -41,7 +42,7 @@ pub async fn mongo_list_databases_core(state: &AppState, connection_id: &str) ->
Err(error) => Err(error),
}
}
- _ => Err("Not a MongoDB/Elasticsearch connection".to_string()),
+ _ => Err("Not a MongoDB/Elasticsearch/vector connection".to_string()),
}
}
@@ -69,11 +70,12 @@ pub async fn mongo_list_collections_core(
match connections.get(connection_id).ok_or("Not found")? {
PoolKind::MongoDb(client) => mongo_driver::list_collections(client, database).await.map(sort_names),
PoolKind::Elasticsearch(client) => elasticsearch_driver::list_indices(client).await.map(sort_names),
+ PoolKind::VectorDb(client) => vector_driver::list_collections(client).await.map(sort_names),
PoolKind::Agent(client) => {
let mut client = client.lock().await;
client.mongo_list_collections(database).await.map(sort_names)
}
- _ => Err("Not a MongoDB/Elasticsearch connection".to_string()),
+ _ => Err("Not a MongoDB/Elasticsearch/vector connection".to_string()),
}
}
@@ -99,6 +101,12 @@ pub async fn document_find_documents_core(
drop(connections);
elasticsearch_driver::find_documents(&client, collection, skip, limit, filter, sort).await
}
+ PoolKind::VectorDb(client) => {
+ let client = client.clone();
+ drop(connections);
+ let _ = (database, filter, sort);
+ vector_driver::find_documents(&client, collection, skip, limit).await
+ }
PoolKind::Agent(client) => {
let mut client = client.lock().await;
client
@@ -112,7 +120,7 @@ pub async fn document_find_documents_core(
}))
.await
}
- _ => Err("Not a MongoDB/Elasticsearch connection".to_string()),
+ _ => Err("Not a MongoDB/Elasticsearch/vector connection".to_string()),
}
}
diff --git a/crates/dbx-core/src/query.rs b/crates/dbx-core/src/query.rs
index 779c15e71b..adb29198f9 100644
--- a/crates/dbx-core/src/query.rs
+++ b/crates/dbx-core/src/query.rs
@@ -957,6 +957,15 @@ pub async fn do_execute(
.await
.map(|result| truncate_result_with_max_rows(result, max_rows))
}
+ PoolKind::VectorDb(client) => {
+ let client = client.clone();
+ let sql = sql.to_string();
+ let max_rows = options.max_rows;
+ drop(connections);
+ wait_for_query_opt(cancel_token, query_timeout, db::vector_driver::execute_rest_query(&client, &sql))
+ .await
+ .map(|result| truncate_result_with_max_rows(result, max_rows))
+ }
PoolKind::Redis(_) => Err("Use Redis-specific commands".to_string()),
PoolKind::MongoDb(_) => Err("Use MongoDB-specific commands".to_string()),
PoolKind::MessageQueue => Err("Use Message Queue-specific commands".to_string()),
@@ -1681,6 +1690,7 @@ pub async fn execute_statements_in_transaction(
| PoolKind::Redis(_)
| PoolKind::MongoDb(_)
| PoolKind::Elasticsearch(_)
+ | PoolKind::VectorDb(_)
| PoolKind::InfluxDb(_)
| PoolKind::ExternalTabular(_)
| PoolKind::ExternalDriver { .. } => TxPath::None,
@@ -1689,6 +1699,7 @@ pub async fn execute_statements_in_transaction(
| PoolKind::Redis(_)
| PoolKind::MongoDb(_)
| PoolKind::Elasticsearch(_)
+ | PoolKind::VectorDb(_)
| PoolKind::InfluxDb(_)
| PoolKind::ExternalTabular(_)
| PoolKind::ExternalDriver { .. } => TxPath::None,
diff --git a/crates/dbx-core/src/query_execution_sql.rs b/crates/dbx-core/src/query_execution_sql.rs
index b968fd828d..22dfa6e7f6 100644
--- a/crates/dbx-core/src/query_execution_sql.rs
+++ b/crates/dbx-core/src/query_execution_sql.rs
@@ -87,6 +87,8 @@ pub fn supports_sql_query(database_type: DatabaseType) -> bool {
DatabaseType::Redis
| DatabaseType::MongoDb
| DatabaseType::Elasticsearch
+ | DatabaseType::Qdrant
+ | DatabaseType::Milvus
| DatabaseType::InfluxDb
| DatabaseType::Neo4j
| DatabaseType::Etcd
diff --git a/crates/dbx-core/src/schema.rs b/crates/dbx-core/src/schema.rs
index bfd82985e6..69100a1d6d 100644
--- a/crates/dbx-core/src/schema.rs
+++ b/crates/dbx-core/src/schema.rs
@@ -678,6 +678,10 @@ async fn list_tables_once(
.await
.map(|names| collection_names_to_tables(names, "INDEX"))
.map(|tables| filter_table_infos(tables, filter, limit, offset, object_types)),
+ PoolKind::VectorDb(client) => db::vector_driver::list_collections(client)
+ .await
+ .map(|names| collection_names_to_tables(names, "COLLECTION"))
+ .map(|tables| filter_table_infos(tables, filter, limit, offset, object_types)),
_ => Ok(vec![]),
}
}
diff --git a/crates/dbx-core/src/schema/providers/native.rs b/crates/dbx-core/src/schema/providers/native.rs
index 13923bd035..8c4a0b0bcc 100644
--- a/crates/dbx-core/src/schema/providers/native.rs
+++ b/crates/dbx-core/src/schema/providers/native.rs
@@ -58,6 +58,9 @@ pub(in crate::schema) async fn list_tables(
PoolKind::Elasticsearch(client) => {
db::elasticsearch_driver::list_indices(client).await.map(|names| collection_names_to_tables(names, "INDEX"))
}
+ PoolKind::VectorDb(client) => {
+ db::vector_driver::list_collections(client).await.map(|names| collection_names_to_tables(names, "COLLECTION"))
+ }
_ => Ok(vec![]),
}
}
@@ -136,6 +139,7 @@ pub(in crate::schema) async fn get_columns(
PoolKind::Rqlite(client) => db::rqlite_driver::get_columns(client, schema, table).await,
PoolKind::Turso(client) => db::turso_driver::get_columns(client, schema, table).await,
PoolKind::Elasticsearch(client) => db::elasticsearch_driver::get_columns(client, table).await,
+ PoolKind::VectorDb(_) => Ok(vec![]),
_ => Ok(vec![]),
}
}
@@ -333,4 +337,4 @@ fn is_mysql_system_database(name: &str) -> bool {
fn is_questdb_config(config: &ConnectionConfig) -> bool {
matches!(config.db_type, DatabaseType::Questdb)
|| matches!(config.driver_profile.as_deref(), Some("questdb"))
-}
\ No newline at end of file
+}
diff --git a/crates/dbx-core/src/sql_dialect/table_select.rs b/crates/dbx-core/src/sql_dialect/table_select.rs
index 9d539abd53..b8a560780f 100644
--- a/crates/dbx-core/src/sql_dialect/table_select.rs
+++ b/crates/dbx-core/src/sql_dialect/table_select.rs
@@ -82,6 +82,10 @@ pub fn build_table_data_select_sql(options: TableDataSelectSqlOptions) -> String
);
}
+ if database_type == Some(DatabaseType::OceanbaseOracle) {
+ return build_oceanbase_oracle_table_select_sql(&table_alias, &where_clause, &order, &select_columns, limit);
+ }
+
if database_type == Some(DatabaseType::Oracle) {
return format!("SELECT {select_columns} FROM {table_alias}{where_clause}{order}");
}
@@ -165,6 +169,11 @@ pub fn build_table_select_sql(options: TableSelectSqlOptions<'_>) -> String {
return format!("SELECT FIRST {limit} {select_columns} FROM {table}{order_by}");
}
+ if database_type == Some(DatabaseType::OceanbaseOracle) {
+ let inner_select = format!("SELECT {select_columns} FROM {table}{order_by}");
+ return format!("SELECT {select_columns} FROM ({inner_select}) WHERE ROWNUM <= {limit}");
+ }
+
if database_type.is_some_and(uses_fetch_first) {
return format!("SELECT {select_columns} FROM {table}{order_by} FETCH FIRST {limit} ROWS ONLY");
}
@@ -189,6 +198,17 @@ fn informix_row_limit_clause(limit: usize, offset: usize) -> String {
}
}
+fn build_oceanbase_oracle_table_select_sql(
+ table: &str,
+ where_clause: &str,
+ order: &str,
+ select_columns: &str,
+ limit: usize,
+) -> String {
+ let inner_select = format!("SELECT {select_columns} FROM {table}{where_clause}{order}");
+ format!("SELECT {select_columns} FROM ({inner_select}) WHERE ROWNUM <= {limit}")
+}
+
pub(super) fn is_oracle_row_id(database_type: Option<DatabaseType>, name: &str) -> bool {
database_type == Some(DatabaseType::Oracle) && name.eq_ignore_ascii_case(DBX_ROWID_COLUMN)
}
diff --git a/crates/dbx-core/src/sql_dialect/tests.rs b/crates/dbx-core/src/sql_dialect/tests.rs
index 430836dee7..11e4f956ab 100644
--- a/crates/dbx-core/src/sql_dialect/tests.rs
+++ b/crates/dbx-core/src/sql_dialect/tests.rs
@@ -90,6 +90,17 @@ fn builds_select_sql_with_limit_syntax_for_database_type() {
}),
"SELECT \"id\", \"name\" FROM \"DB2INST1\".\"USERS\" ORDER BY \"id\" ASC FETCH FIRST 100 ROWS ONLY"
);
+ assert_eq!(
+ build_table_select_sql(TableSelectSqlOptions {
+ database_type: Some(DatabaseType::OceanbaseOracle),
+ schema: Some("DBXTEST"),
+ table_name: "USERS",
+ columns: &columns,
+ order_columns: &keys,
+ limit: 100,
+ }),
+ "SELECT \"id\", \"name\" FROM (SELECT \"id\", \"name\" FROM \"DBXTEST\".\"USERS\" ORDER BY \"id\" ASC) WHERE ROWNUM <= 100"
+ );
// JDBC connections skip SQL-level row limiting — the JDBC agent handles
// it via Statement.setMaxRows() which is universally supported.
assert_eq!(
@@ -269,6 +280,38 @@ fn builds_table_data_where_and_schema_queries() {
}),
"SELECT * FROM \"DB2INST1\".\"ORDERS\" WHERE (amount > 10) FETCH FIRST 50 ROWS ONLY"
);
+ assert_eq!(
+ build_table_data_select_sql(TableDataSelectSqlOptions {
+ database_type: Some(DatabaseType::OceanbaseOracle),
+ schema: Some("DBXTEST".to_string()),
+ table_name: "ORDERS".to_string(),
+ primary_keys: Vec::new(),
+ columns: Vec::new(),
+ fallback_order_columns: Vec::new(),
+ order_by: None,
+ limit: Some(100),
+ offset: None,
+ where_input: None,
+ include_row_id: false,
+ }),
+ "SELECT * FROM (SELECT * FROM \"DBXTEST\".\"ORDERS\") WHERE ROWNUM <= 100"
+ );
+ assert_eq!(
+ build_table_data_select_sql(TableDataSelectSqlOptions {
+ database_type: Some(DatabaseType::OceanbaseOracle),
+ schema: Some("DBXTEST".to_string()),
+ table_name: "ORDERS".to_string(),
+ primary_keys: vec!["ID".to_string()],
+ columns: Vec::new(),
+ fallback_order_columns: Vec::new(),
+ order_by: None,
+ limit: Some(50),
+ offset: None,
+ where_input: Some("WHERE amount > 10".to_string()),
+ include_row_id: false,
+ }),
+ "SELECT * FROM (SELECT * FROM \"DBXTEST\".\"ORDERS\" WHERE (amount > 10) ORDER BY \"ID\" ASC) WHERE ROWNUM <= 50"
+ );
assert_eq!(
build_table_data_select_sql(TableDataSelectSqlOptions {
database_type: Some(DatabaseType::Db2),
diff --git a/src-tauri/src/commands/connection.rs b/src-tauri/src/commands/connection.rs
index 8cf54bbd5e..381ca6f485 100644
--- a/src-tauri/src/commands/connection.rs
+++ b/src-tauri/src/commands/connection.rs
@@ -645,6 +645,24 @@ pub async fn test_connection(state: State<'_, Arc<AppState>>, config: Connection
.await
.map(|_| "Connection successful".to_string())
}
+ DatabaseType::Qdrant | DatabaseType::Milvus => {
+ let kind = match config.db_type {
+ DatabaseType::Qdrant => db::vector_driver::VectorDbKind::Qdrant,
+ DatabaseType::Milvus => db::vector_driver::VectorDbKind::Milvus,
+ _ => unreachable!(),
+ };
+ let client = db::vector_driver::VectorClient::new(
+ kind,
+ &url,
+ Some(&config.username),
+ Some(&config.password),
+ config.ssl,
+ connect_timeout,
+ );
+ db::vector_driver::test_connection(&client, connect_timeout)
+ .await
+ .map(|_| "Connection successful".to_string())
+ }
DatabaseType::Rqlite => {
let client = db::rqlite_driver::RqliteClient::new(
&url,
@@ -886,6 +904,23 @@ pub async fn connect_db(state: State<'_, Arc<AppState>>, config: ConnectionConfi
db::elasticsearch_driver::test_connection(&mut client, connect_timeout).await?;
PoolKind::Elasticsearch(client)
}
+ DatabaseType::Qdrant | DatabaseType::Milvus => {
+ let kind = match db_config.db_type {
+ DatabaseType::Qdrant => db::vector_driver::VectorDbKind::Qdrant,
+ DatabaseType::Milvus => db::vector_driver::VectorDbKind::Milvus,
+ _ => unreachable!(),
+ };
+ let client = db::vector_driver::VectorClient::new(
+ kind,
+ &url,
+ Some(&db_config.username),
+ Some(&db_config.password),
+ db_config.ssl,
+ connect_timeout,
+ );
+ db::vector_driver::test_connection(&client, connect_timeout).await?;
+ PoolKind::VectorDb(client)
+ }
DatabaseType::Rqlite => {
let client = db::rqlite_driver::RqliteClient::new(
&url,