feat: add InfluxDB support (#980)

This commit is contained in:
John Jin
2026-06-10 14:37:53 +08:00
committed by GitHub
parent c13efc65f8
commit 0bd07ccf46
23 changed files with 470 additions and 7 deletions
@@ -416,6 +416,7 @@ const driverProfiles: Record<
iotdb: { type: "iotdb", port: 6667, user: "root", label: "Apache IoTDB", icon: "iotdb" },
etcd: { type: "etcd", port: 2379, user: "", label: "etcd", icon: "etcd" },
iris: { type: "iris", port: 1972, user: "_SYSTEM", label: "IRIS", icon: "iris" },
influxdb: { type: "influxdb", port: 8086, user: "", label: "InfluxDB", icon: "InfluxDB" },
custom_mysql: {
type: "mysql",
port: 3306,
@@ -715,6 +716,7 @@ const iconTypeMap: Record<string, string> = {
bigquery: "bigquery",
kylin: "kylin",
sundb: "sundb",
influxdb: "influxdb",
jdbc: "jdbc",
custom_mysql: "mysql",
custom_postgres: "postgres",
@@ -777,6 +779,7 @@ const dbOptions = [
{ value: "xugu", label: "虚谷 XuguDB" },
{ value: "iotdb", label: "Apache IoTDB" },
{ value: "etcd", label: "etcd" },
{ value: "influxdb", label: "InfluxDB" },
{ value: "iris", label: "IRIS" },
{ value: "jdbc", label: "JDBC" },
{ value: "custom_mysql", label: "Custom (MySQL)" },
@@ -824,7 +827,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", "redis", "etcd", "clickhouse", "elasticsearch"]);
const tlsCapableDatabaseTypes = new Set<DatabaseType>(["mysql", "postgres", "redshift", "gaussdb", "kwdb", "opengauss", "redis", "etcd", "clickhouse", "elasticsearch", "influxdb"]);
const supportsTlsToggle = computed(() => tlsCapableDatabaseTypes.has(form.value.db_type));
const supportsCaCertificatePath = computed(() => form.value.db_type === "clickhouse");
const bareMysqlProfiles = new Set(["doris", "starrocks", "selectdb", "oceanbase"]);
@@ -73,6 +73,7 @@ const assetIcons: Record<string, string> = {
iotdb: "iotdb",
etcd: "etcd",
iris: "iris.png",
influxdb: "influxdb",
};
const letterIcons: Record<string, { letter: string; color: string }> = {};
@@ -184,7 +184,11 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
case "view":
return { icon: Eye, colorClass: "text-purple-500" };
case "column":
return { icon: Columns3, colorClass: "text-muted-foreground" };
if ((node.meta as ColumnInfo).is_primary_key) {
return { icon: Columns3, colorClass: "text-orange-400" };
} else {
return { icon: Columns3, colorClass: "text-muted-foreground" };
}
case "group-columns":
return { icon: ListTree, colorClass: "text-green-400" };
case "group-indexes":
@@ -145,6 +145,9 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string {
case "iris":
return "iris://user:password@host:port/namespace";
case "influxdb":
return "influxdb://user:password@host:port/database";
case "jdbc":
return "jdbc:mysql://host:3306/database";
@@ -145,7 +145,7 @@ export const TABLE_STRUCTURE_SUPPORTED_TYPES = new Set<DatabaseType>([
"access",
]);
export const CREATE_DATABASE_SUPPORTED_TYPES = new Set<DatabaseType>(["mysql", "postgres", "sqlserver", "clickhouse", "oracle", "gaussdb", "kwdb", "opengauss", "oceanbase-oracle", "doris", "starrocks", "redshift"]);
export const CREATE_DATABASE_SUPPORTED_TYPES = new Set<DatabaseType>(["mysql", "postgres", "sqlserver", "clickhouse", "oracle", "gaussdb", "kwdb", "opengauss", "oceanbase-oracle", "doris", "starrocks", "redshift", "influxdb"]);
export const FIELD_LINEAGE_SUPPORTED_TYPES = new Set<DatabaseType>(["mysql", "postgres", "sqlite", "rqlite", "turso", "sqlserver", "oracle", "redshift", "dameng", "gaussdb", "kwdb", "opengauss", "oceanbase-oracle"]);
@@ -96,7 +96,7 @@ export function supportsObjectBrowserTreeNode(dbType: DatabaseType | undefined,
}
export function supportsTableTruncate(dbType?: DatabaseType): boolean {
return !!dbType && dbType !== "sqlite" && dbType !== "rqlite" && dbType !== "turso" && dbType !== "duckdb";
return !!dbType && dbType !== "sqlite" && dbType !== "rqlite" && dbType !== "turso" && dbType !== "duckdb" && dbType !== "influxdb";
}
export function usesPostgresLikeStructureCopy(dbType?: DatabaseType): boolean {
@@ -137,6 +137,18 @@ const DATABASE_CAPABILITY_OVERRIDES: Partial<Record<DatabaseType, Partial<Databa
transaction: false,
},
},
influxdb: {
tableData: {
insert: false,
updateRequiresPrimaryKey: false,
deleteRequiresPrimaryKey: true,
keylessRowPredicate: false,
requiresTransactionalTableForExistingRows: false,
existingRowsReadonly: true,
transaction: false,
readonly: true,
},
},
};
function defaultTableDataCapability(dbType?: DatabaseType): TableDataCapability {
+1
View File
@@ -50,6 +50,7 @@ const profileMap: Record<string, ConnectionProfile> = {
gaussdb: { dbType: "gaussdb", profile: "gaussdb", label: "GaussDB", port: 5432, user: "gaussdb" },
kwdb: { dbType: "kwdb", profile: "kwdb", label: "KWDB", port: 26257, user: "root" },
opengauss: { dbType: "gaussdb", profile: "opengauss", label: "openGauss", port: 5432, user: "gaussdb" },
influxdb: { dbType: "influxdb", profile: "influxdb", label: "InfluxDB", port: 8086, user: "" },
};
function normalizeKey(value: unknown) {
@@ -1,6 +1,6 @@
import type { DatabaseType } from "@/types/database";
export type TableStructureDialect = "mysql" | "postgres" | "sqlite" | "duckdb" | "sqlserver" | "oracle" | "h2" | "clickhouse" | "unsupported";
export type TableStructureDialect = "mysql" | "postgres" | "sqlite" | "duckdb" | "sqlserver" | "oracle" | "h2" | "clickhouse" | "influxdb" | "unsupported";
export interface TableStructureCapabilities {
dialect: TableStructureDialect;
@@ -199,6 +199,20 @@ const accessCapabilities = capabilities({
createIndex: true,
});
const influxdbCapabilities = capabilities({
dialect: "influxdb",
createTable: false,
addColumn: false,
dropColumn: false,
renameColumn: false,
alterExistingColumn: false,
alterType: false,
alterNullability: false,
alterDefault: false,
reorderColumn: false,
comment: false,
});
const capabilityByType: Partial<Record<DatabaseType, TableStructureCapabilities>> = {
mysql: mysqlCapabilities,
doris: mysqlCapabilities,
@@ -225,6 +239,7 @@ const capabilityByType: Partial<Record<DatabaseType, TableStructureCapabilities>
h2: h2Capabilities,
access: accessCapabilities,
clickhouse: clickhouseCapabilities,
influxdb: influxdbCapabilities,
};
export function getTableStructureCapabilities(dbType?: DatabaseType): TableStructureCapabilities {
+3 -1
View File
@@ -257,6 +257,7 @@ export const useConnectionStore = defineStore("connection", () => {
bigquery: "BigQuery",
kylin: "Kylin",
sundb: "SunDB",
influxdb: "InfluxDB",
};
const profile = config.driver_profile || config.db_type;
@@ -1201,7 +1202,8 @@ export const useConnectionStore = defineStore("connection", () => {
},
];
if (node.type === "table") {
const config = getConfig(connectionId);
if (node.type === "table" && config?.db_type !== "influxdb") {
children.push(
{
id: `${parentId}:__indexes`,
+1
View File
@@ -49,6 +49,7 @@ export type DatabaseType =
| "iotdb"
| "etcd"
| "iris"
| "influxdb"
| "jdbc";
export interface SqlSnippet {