feat(export): honor exclude-primary-keys in SQL script exports

This commit is contained in:
高桥凉介 authored and GitHub committed 2026-09-17 14:13:36 +08:00
1 parent 137a1a4161
commit d17ce46626
16 files changed
+464 -68

No files matched your search

+6
View File
@@ -5365,6 +5365,8 @@ export interface TableExportRequest {
columnTypes?: Array<string | null | undefined>;
columnComments?: Array<string | null> | null;
primaryKeys?: string[];
/** 导出 SQL 时是否排除主键列(对应数据提取设置里的“排除主键”)。 */
excludePrimaryKeys?: boolean;
whereInput?: string;
orderBy?: string;
skipCount?: boolean;
@@ -5427,6 +5429,10 @@ export interface QueryResultExportRequest {
columnComments?: Array<string | null> | null;
autoFilter?: boolean;
identifierQuote?: string;
/** 导出 SQL 时是否排除主键列(对应数据提取设置里的“排除主键”)。 */
excludePrimaryKeys?: boolean;
/** 结果集对应的原表主键列名,由前端从表元数据带入。 */
primaryKeys?: string[];
}
export async function startTableExport(request: TableExportRequest, onProgress: (progress: TableExportProgress) => void): Promise<TableExportProgress> {
@@ -47,6 +47,8 @@ export interface BuildExportInsertStatementsOptions {
spatialColumns?: QueryResult["spatial_columns"];
spatialValues?: QueryResult["spatial_values"];
rows: QueryResult["rows"];
/** 生成 INSERT 时需要排除的列名(例如导出时不带主键),忽略大小写匹配。 */
excludeColumns?: string[];
batchSize?: number;
}
@@ -40,6 +40,7 @@ export interface FormatSqlInsertOptions {
spatialValues?: QueryResult["spatial_values"];
rows: ExportCellValue[][];
insertMode?: SqlInsertMode;
excludeColumns?: string[];
}
export function formatSqlInsert({ insertMode = "batch", ...options }: FormatSqlInsertOptions): Promise<string> {