1 parent
ba3872abef
commit
1d07cb05e0
22 files changed
+384
-83
No files matched your search
@@ -20,6 +20,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Download, Square, CheckSquare, Search, X, Loader2, Wrench } from "@lucide/vue";
|
import { Download, Square, CheckSquare, Search, X, Loader2, Wrench } from "@lucide/vue";
|
||||||
import { formatDataTransferDuration, useExportTracker } from "@/composables/useExportTracker";
|
import { formatDataTransferDuration, useExportTracker } from "@/composables/useExportTracker";
|
||||||
import { isQueryTimeoutErrorMessage } from "@/lib/sql/queryError";
|
import { isQueryTimeoutErrorMessage } from "@/lib/sql/queryError";
|
||||||
|
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
@@ -64,6 +65,7 @@ const POSTGRES_ALL_SCHEMAS = "__DBX_ALL_SCHEMAS__";
|
|||||||
// Options
|
// Options
|
||||||
const includeStructure = ref(true);
|
const includeStructure = ref(true);
|
||||||
const includeData = ref(true);
|
const includeData = ref(true);
|
||||||
|
const insertDialect = ref<SqlInsertDialect>("source");
|
||||||
const includeObjects = ref(true);
|
const includeObjects = ref(true);
|
||||||
const includeCreateDatabase = ref(false);
|
const includeCreateDatabase = ref(false);
|
||||||
const dropTableIfExists = ref(false);
|
const dropTableIfExists = ref(false);
|
||||||
@@ -396,6 +398,7 @@ async function startExport() {
|
|||||||
selectedTables: !isPostgresAllSchemas.value && (includeStructure.value || includeData.value) ? buildSelectedTablesPayload(tables.value, selectedTables.value) : undefined,
|
selectedTables: !isPostgresAllSchemas.value && (includeStructure.value || includeData.value) ? buildSelectedTablesPayload(tables.value, selectedTables.value) : undefined,
|
||||||
includeStructure: includeStructure.value,
|
includeStructure: includeStructure.value,
|
||||||
includeData: includeData.value,
|
includeData: includeData.value,
|
||||||
|
insertDialect: insertDialect.value,
|
||||||
includeObjects: includeObjects.value,
|
includeObjects: includeObjects.value,
|
||||||
includeCreateDatabase: includeCreateDatabase.value,
|
includeCreateDatabase: includeCreateDatabase.value,
|
||||||
dropTableIfExists: dropTableIfExists.value,
|
dropTableIfExists: dropTableIfExists.value,
|
||||||
@@ -538,6 +541,7 @@ async function startAllDatabasesExport() {
|
|||||||
filePath,
|
filePath,
|
||||||
includeStructure: includeStructure.value,
|
includeStructure: includeStructure.value,
|
||||||
includeData: includeData.value,
|
includeData: includeData.value,
|
||||||
|
insertDialect: insertDialect.value,
|
||||||
includeObjects: includeObjects.value,
|
includeObjects: includeObjects.value,
|
||||||
includeCreateDatabase: includeCreateDatabase.value,
|
includeCreateDatabase: includeCreateDatabase.value,
|
||||||
dropTableIfExists: dropTableIfExists.value,
|
dropTableIfExists: dropTableIfExists.value,
|
||||||
@@ -659,6 +663,7 @@ function resetState() {
|
|||||||
databaseFilter.value = "";
|
databaseFilter.value = "";
|
||||||
includeStructure.value = true;
|
includeStructure.value = true;
|
||||||
includeData.value = true;
|
includeData.value = true;
|
||||||
|
insertDialect.value = "source";
|
||||||
includeObjects.value = true;
|
includeObjects.value = true;
|
||||||
includeCreateDatabase.value = false;
|
includeCreateDatabase.value = false;
|
||||||
dropTableIfExists.value = false;
|
dropTableIfExists.value = false;
|
||||||
@@ -947,6 +952,16 @@ watch(
|
|||||||
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||||
{{ t("databaseExport.includeData") }}
|
{{ t("databaseExport.includeData") }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="space-y-1">
|
||||||
|
<button type="button" class="flex items-center gap-2 text-left text-xs" :class="includeData ? 'cursor-pointer' : 'cursor-not-allowed text-muted-foreground/50'" :disabled="!includeData" @click="insertDialect = insertDialect === 'standard' ? 'source' : 'standard'">
|
||||||
|
<CheckSquare v-if="includeData && insertDialect === 'standard'" class="w-3.5 h-3.5 text-primary shrink-0" />
|
||||||
|
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||||
|
{{ t("databaseExport.standardSqlInsert") }}
|
||||||
|
</button>
|
||||||
|
<p class="pl-5 text-[11px] text-muted-foreground">
|
||||||
|
{{ t("databaseExport.standardSqlInsertDescription") }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div class="flex items-center gap-2 cursor-pointer text-xs" @click="includeObjects = !includeObjects">
|
<div class="flex items-center gap-2 cursor-pointer text-xs" @click="includeObjects = !includeObjects">
|
||||||
<CheckSquare v-if="includeObjects" class="w-3.5 h-3.5 text-primary shrink-0" />
|
<CheckSquare v-if="includeObjects" class="w-3.5 h-3.5 text-primary shrink-0" />
|
||||||
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
<Square v-else class="w-3.5 h-3.5 text-muted-foreground/40 shrink-0" />
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ import { buildRenameObjectSql, supportsObjectRename } from "@/lib/table/objectRe
|
|||||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||||
import { generateDatabaseExportId } from "@/lib/export/databaseExport";
|
import { generateDatabaseExportId } from "@/lib/export/databaseExport";
|
||||||
import { buildXlsxHeaderOverrides, hasXlsxHeaderComments, type XlsxExportOptions, type XlsxHeaderMode } from "@/lib/export/xlsxHeader";
|
import { buildXlsxHeaderOverrides, hasXlsxHeaderComments, type XlsxExportOptions, type XlsxHeaderMode } from "@/lib/export/xlsxHeader";
|
||||||
import { showSqlInsertModeDialog, type SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
import { showSqlInsertModeDialog, type SqlInsertDialect, type SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||||
import { copyToClipboard, eventTargetAllowsAppClipboardShortcut } from "@/lib/common/clipboard";
|
import { copyToClipboard, eventTargetAllowsAppClipboardShortcut } from "@/lib/common/clipboard";
|
||||||
import {
|
import {
|
||||||
defaultPasteTableMode,
|
defaultPasteTableMode,
|
||||||
@@ -2321,14 +2321,14 @@ async function exportDataLegacy(row: ObjectBrowserRow, format: "json") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportData(row: ObjectBrowserRow, format: "csv" | "json" | "sql") {
|
async function exportData(row: ObjectBrowserRow, format: "csv" | "json" | "sql", insertDialect: SqlInsertDialect = "source") {
|
||||||
if (format === "json") {
|
if (format === "json") {
|
||||||
await exportDataLegacy(row, format);
|
await exportDataLegacy(row, format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sqlExportOptions = format === "sql" ? await showSqlInsertModeDialog({ allowSplit: true }) : undefined;
|
const sqlExportOptions = format === "sql" ? await showSqlInsertModeDialog({ allowSplit: true }) : undefined;
|
||||||
if (format === "sql" && sqlExportOptions === null) return;
|
if (format === "sql" && sqlExportOptions === null) return;
|
||||||
await exportTableData(row, format, undefined, "name", true, sqlExportOptions?.insertMode ?? "batch", sqlExportOptions?.splitMaxMb);
|
await exportTableData(row, format, undefined, "name", true, sqlExportOptions?.insertMode ?? "batch", sqlExportOptions?.splitMaxMb, insertDialect);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showObjectBrowserXlsxHeaderDialog(hasComments: boolean): Promise<XlsxExportOptions | null> {
|
function showObjectBrowserXlsxHeaderDialog(hasComments: boolean): Promise<XlsxExportOptions | null> {
|
||||||
@@ -2371,7 +2371,7 @@ async function exportDataXlsx(row: ObjectBrowserRow) {
|
|||||||
await exportTableData(row, "xlsx", columnInfos, exportOptions.headerMode, exportOptions.autoFilter);
|
await exportTableData(row, "xlsx", columnInfos, exportOptions.headerMode, exportOptions.autoFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "sql", columnInfos?: ColumnInfo[], headerMode: XlsxHeaderMode = "name", autoFilter = true, insertMode: SqlInsertMode = "batch", splitMaxMb?: number) {
|
async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "sql", columnInfos?: ColumnInfo[], headerMode: XlsxHeaderMode = "name", autoFilter = true, insertMode: SqlInsertMode = "batch", splitMaxMb?: number, insertDialect: SqlInsertDialect = "source") {
|
||||||
const schema = row.schema || selectedSchema.value;
|
const schema = row.schema || selectedSchema.value;
|
||||||
const splitSqlOutput = format === "sql" && splitMaxMb !== undefined;
|
const splitSqlOutput = format === "sql" && splitMaxMb !== undefined;
|
||||||
|
|
||||||
@@ -2446,7 +2446,7 @@ async function exportTableData(row: ObjectBrowserRow, format: "csv" | "xlsx" | "
|
|||||||
tableName: row.name,
|
tableName: row.name,
|
||||||
filePath,
|
filePath,
|
||||||
format,
|
format,
|
||||||
...(format === "sql" ? { insertMode, splitMaxMb } : {}),
|
...(format === "sql" ? { insertMode, insertDialect, splitMaxMb } : {}),
|
||||||
csvQuoteMode: settingsStore.editorSettings.csvQuoteMode,
|
csvQuoteMode: settingsStore.editorSettings.csvQuoteMode,
|
||||||
columns,
|
columns,
|
||||||
columnComments: format === "xlsx" ? columnComments : undefined,
|
columnComments: format === "xlsx" ? columnComments : undefined,
|
||||||
@@ -3373,7 +3373,10 @@ function exportDataSubmenu(item: ObjectBrowserRow): ContextMenuItem {
|
|||||||
{ label: "CSV", action: () => exportData(item, "csv") },
|
{ label: "CSV", action: () => exportData(item, "csv") },
|
||||||
{ label: "JSON", action: () => exportData(item, "json") },
|
{ label: "JSON", action: () => exportData(item, "json") },
|
||||||
];
|
];
|
||||||
if (!isVictoriaMetrics.value) formats.push({ label: "SQL INSERT", action: () => exportData(item, "sql") });
|
if (!isVictoriaMetrics.value) {
|
||||||
|
formats.push({ label: "SQL INSERT", action: () => exportData(item, "sql", "source") });
|
||||||
|
formats.push({ label: t("contextMenu.standardSqlInsert"), action: () => exportData(item, "sql", "standard") });
|
||||||
|
}
|
||||||
formats.push({ label: "XLSX", action: () => exportDataXlsx(item) });
|
formats.push({ label: "XLSX", action: () => exportDataXlsx(item) });
|
||||||
return {
|
return {
|
||||||
label: t("contextMenu.exportData"),
|
label: t("contextMenu.exportData"),
|
||||||
|
|||||||
@@ -5492,7 +5492,10 @@ function exportDataSubmenu(includeSqlInsert = true): ContextMenuItem {
|
|||||||
{ label: "CSV", action: () => exportData("csv") },
|
{ label: "CSV", action: () => exportData("csv") },
|
||||||
{ label: "JSON", action: () => exportData("json") },
|
{ label: "JSON", action: () => exportData("json") },
|
||||||
];
|
];
|
||||||
if (includeSqlInsert) children.push({ label: "SQL INSERT", action: () => exportData("sql") });
|
if (includeSqlInsert) {
|
||||||
|
children.push({ label: "SQL INSERT", action: () => exportData("sql", "source") });
|
||||||
|
children.push({ label: t("contextMenu.standardSqlInsert"), action: () => exportData("sql", "standard") });
|
||||||
|
}
|
||||||
children.push({ label: "XLSX", action: () => exportDataXlsx() });
|
children.push({ label: "XLSX", action: () => exportDataXlsx() });
|
||||||
return {
|
return {
|
||||||
label: count > 1 ? t("contextMenu.exportDataMultiple", { count }) : t("contextMenu.exportData"),
|
label: count > 1 ? t("contextMenu.exportDataMultiple", { count }) : t("contextMenu.exportData"),
|
||||||
|
|||||||
@@ -540,4 +540,35 @@ describe("useSidebarTreeExportRuntime", () => {
|
|||||||
expect(apiMock.startTableExport).toHaveBeenCalledOnce();
|
expect(apiMock.startTableExport).toHaveBeenCalledOnce();
|
||||||
expect(apiMock.startTableExport).toHaveBeenCalledWith(expect.objectContaining({ tableName: "users", filePath: "users.csv" }), expect.any(Function));
|
expect(apiMock.startTableExport).toHaveBeenCalledWith(expect.objectContaining({ tableName: "users", filePath: "users.csv" }), expect.any(Function));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
["source", undefined],
|
||||||
|
["standard", "standard"],
|
||||||
|
] as const)("serializes the %s SQL INSERT dialect for a table export", async (expectedDialect, requestedDialect) => {
|
||||||
|
const activeNode = shallowRef({ id: "table-1", type: "table", label: "users", connectionId: "conn-1", database: "db", schema: "dbo", children: [] } as TreeNode);
|
||||||
|
const connectionStore = {
|
||||||
|
ensureConnected: vi.fn(),
|
||||||
|
getConfig: vi.fn(() => ({ db_type: "sqlserver" })),
|
||||||
|
connectionIdentifierQuote: vi.fn(() => "["),
|
||||||
|
treeNodes: [],
|
||||||
|
selectedTreeNodeIds: [],
|
||||||
|
};
|
||||||
|
const runtime = useSidebarTreeExportRuntime({
|
||||||
|
activeNode,
|
||||||
|
connectionStore: connectionStore as never,
|
||||||
|
settingsStore: exportSettings() as never,
|
||||||
|
acceptedSelectionIds: () => null,
|
||||||
|
});
|
||||||
|
|
||||||
|
await runtime.exportData("sql", requestedDialect);
|
||||||
|
|
||||||
|
expect(apiMock.startTableExport).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
format: "sql",
|
||||||
|
insertDialect: expectedDialect,
|
||||||
|
identifierQuote: "[",
|
||||||
|
}),
|
||||||
|
expect.any(Function),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -32,6 +32,7 @@ import {
|
|||||||
structurePreviewDdlStorageType,
|
structurePreviewDdlStorageType,
|
||||||
} from "@/components/sidebar/sidebarTreeDialogState";
|
} from "@/components/sidebar/sidebarTreeDialogState";
|
||||||
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||||
|
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||||
|
|
||||||
type StructureCopyFormat = "tsv" | "markdown";
|
type StructureCopyFormat = "tsv" | "markdown";
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@ interface ExportTableDataOptions {
|
|||||||
autoFilter?: boolean;
|
autoFilter?: boolean;
|
||||||
outputDirectory?: string;
|
outputDirectory?: string;
|
||||||
suppressDoneToast?: boolean;
|
suppressDoneToast?: boolean;
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
}
|
}
|
||||||
|
|
||||||
function joinExportFilePath(directory: string, fileName: string): string {
|
function joinExportFilePath(directory: string, fileName: string): string {
|
||||||
@@ -434,7 +436,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function exportTableData(target: SidebarTableExportTarget, format: "csv" | "xlsx" | "sql", exportOptions: ExportTableDataOptions = {}) {
|
async function exportTableData(target: SidebarTableExportTarget, format: "csv" | "xlsx" | "sql", exportOptions: ExportTableDataOptions = {}) {
|
||||||
const { columnInfos, headerMode = "name", autoFilter = true, outputDirectory, suppressDoneToast = false } = exportOptions;
|
const { columnInfos, headerMode = "name", autoFilter = true, outputDirectory, suppressDoneToast = false, insertDialect = "source" } = exportOptions;
|
||||||
const { connectionId, database } = target;
|
const { connectionId, database } = target;
|
||||||
|
|
||||||
let task: ExportTask | null = null;
|
let task: ExportTask | null = null;
|
||||||
@@ -486,6 +488,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
|||||||
tableName: target.tableName,
|
tableName: target.tableName,
|
||||||
filePath: outputPath,
|
filePath: outputPath,
|
||||||
format,
|
format,
|
||||||
|
...(format === "sql" ? { insertDialect } : {}),
|
||||||
csvQuoteMode: target.csvQuoteMode,
|
csvQuoteMode: target.csvQuoteMode,
|
||||||
columns: queryColumns,
|
columns: queryColumns,
|
||||||
columnComments,
|
columnComments,
|
||||||
@@ -566,7 +569,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportData(format: "csv" | "json" | "sql") {
|
async function exportData(format: "csv" | "json" | "sql", insertDialect: SqlInsertDialect = "source") {
|
||||||
const targets = currentTableExportTargets();
|
const targets = currentTableExportTargets();
|
||||||
if (!targets.length) return;
|
if (!targets.length) return;
|
||||||
|
|
||||||
@@ -584,7 +587,7 @@ export function useSidebarTreeExportRuntime(options: SidebarTreeExportRuntimeOpt
|
|||||||
|
|
||||||
let exported = 0;
|
let exported = 0;
|
||||||
for (const target of targets) {
|
for (const target of targets) {
|
||||||
if (await exportTableData(target, format, { outputDirectory, suppressDoneToast: targets.length > 1 })) exported += 1;
|
if (await exportTableData(target, format, { outputDirectory, suppressDoneToast: targets.length > 1, insertDialect })) exported += 1;
|
||||||
}
|
}
|
||||||
if (targets.length > 1 && exported > 0) toast(t("contextMenu.exportDataMultipleSuccess", { count: exported }));
|
if (targets.length > 1 && exported > 0) toast(t("contextMenu.exportDataMultipleSuccess", { count: exported }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3884,6 +3884,7 @@ export default {
|
|||||||
restoreSqliteDatabaseFailed: "Failed to restore SQLite database: {message}",
|
restoreSqliteDatabaseFailed: "Failed to restore SQLite database: {message}",
|
||||||
importData: "Import Data",
|
importData: "Import Data",
|
||||||
exportData: "Export Data",
|
exportData: "Export Data",
|
||||||
|
standardSqlInsert: "Standard SQL INSERT",
|
||||||
exportDataMultiple: "Export Data ({count} tables)",
|
exportDataMultiple: "Export Data ({count} tables)",
|
||||||
exportDataSelectDirectory: "Select export folder",
|
exportDataSelectDirectory: "Select export folder",
|
||||||
exportDataMultipleSuccess: "Exported {count} tables",
|
exportDataMultipleSuccess: "Exported {count} tables",
|
||||||
@@ -9210,6 +9211,8 @@ export default {
|
|||||||
dropTableIfExists: "Add DROP TABLE IF EXISTS before DDL",
|
dropTableIfExists: "Add DROP TABLE IF EXISTS before DDL",
|
||||||
omitAutoIncrement: "Omit AUTO_INCREMENT (for fresh-install scripts)",
|
omitAutoIncrement: "Omit AUTO_INCREMENT (for fresh-install scripts)",
|
||||||
includeData: "Table data (INSERT)",
|
includeData: "Table data (INSERT)",
|
||||||
|
standardSqlInsert: "Use Standard SQL INSERT for table data",
|
||||||
|
standardSqlInsertDescription: "Uses ANSI double-quoted identifiers and portable scalar literals. DDL and other objects keep the source database dialect.",
|
||||||
includeObjects: "Views / Procedures / Functions / Sequences",
|
includeObjects: "Views / Procedures / Functions / Sequences",
|
||||||
splitSqlOutput: "Split SQL export into a ZIP archive",
|
splitSqlOutput: "Split SQL export into a ZIP archive",
|
||||||
splitSqlPartMaxMb: "Maximum size per SQL part (MB)",
|
splitSqlPartMaxMb: "Maximum size per SQL part (MB)",
|
||||||
|
|||||||
@@ -3796,6 +3796,7 @@ export default withEnglishFallback({
|
|||||||
restoreSqliteDatabaseFailed: "还原 SQLite 数据库失败:{message}",
|
restoreSqliteDatabaseFailed: "还原 SQLite 数据库失败:{message}",
|
||||||
importData: "导入数据",
|
importData: "导入数据",
|
||||||
exportData: "导出数据",
|
exportData: "导出数据",
|
||||||
|
standardSqlInsert: "标准 SQL INSERT",
|
||||||
exportDataMultiple: "导出数据({count} 张表)",
|
exportDataMultiple: "导出数据({count} 张表)",
|
||||||
exportDataSelectDirectory: "选择导出文件夹",
|
exportDataSelectDirectory: "选择导出文件夹",
|
||||||
exportDataMultipleSuccess: "已导出 {count} 张表",
|
exportDataMultipleSuccess: "已导出 {count} 张表",
|
||||||
@@ -9173,6 +9174,8 @@ export default withEnglishFallback({
|
|||||||
dropTableIfExists: "导出前添加 DROP TABLE IF EXISTS",
|
dropTableIfExists: "导出前添加 DROP TABLE IF EXISTS",
|
||||||
omitAutoIncrement: "省略 AUTO_INCREMENT(用于全新安装的初始化脚本)",
|
omitAutoIncrement: "省略 AUTO_INCREMENT(用于全新安装的初始化脚本)",
|
||||||
includeData: "表数据 (INSERT)",
|
includeData: "表数据 (INSERT)",
|
||||||
|
standardSqlInsert: "表数据使用标准 SQL INSERT",
|
||||||
|
standardSqlInsertDescription: "使用 ANSI 双引号标识符和通用标量字面量;DDL 与其他对象仍保留源数据库方言。",
|
||||||
includeObjects: "视图 / 存储过程 / 函数 / 序列",
|
includeObjects: "视图 / 存储过程 / 函数 / 序列",
|
||||||
splitSqlOutput: "将 SQL 导出拆分为 ZIP 压缩包",
|
splitSqlOutput: "将 SQL 导出拆分为 ZIP 压缩包",
|
||||||
splitSqlPartMaxMb: "每个 SQL 分片的最大大小(MB)",
|
splitSqlPartMaxMb: "每个 SQL 分片的最大大小(MB)",
|
||||||
|
|||||||
@@ -3672,6 +3672,7 @@ export default withEnglishFallback({
|
|||||||
restoreSqliteDatabaseFailed: "還原 SQLite 資料庫失敗:{message}",
|
restoreSqliteDatabaseFailed: "還原 SQLite 資料庫失敗:{message}",
|
||||||
importData: "匯入資料",
|
importData: "匯入資料",
|
||||||
exportData: "匯出資料",
|
exportData: "匯出資料",
|
||||||
|
standardSqlInsert: "標準 SQL INSERT",
|
||||||
exportDataMultiple: "匯出資料({count} 張表)",
|
exportDataMultiple: "匯出資料({count} 張表)",
|
||||||
exportDataSelectDirectory: "選擇匯出資料夾",
|
exportDataSelectDirectory: "選擇匯出資料夾",
|
||||||
exportDataMultipleSuccess: "已匯出 {count} 張表",
|
exportDataMultipleSuccess: "已匯出 {count} 張表",
|
||||||
@@ -7802,6 +7803,8 @@ export default withEnglishFallback({
|
|||||||
dropTableIfExists: "匯出前新增 DROP TABLE IF EXISTS",
|
dropTableIfExists: "匯出前新增 DROP TABLE IF EXISTS",
|
||||||
omitAutoIncrement: "省略 AUTO_INCREMENT(用於全新安裝的初始化腳本)",
|
omitAutoIncrement: "省略 AUTO_INCREMENT(用於全新安裝的初始化腳本)",
|
||||||
includeData: "資料表資料 (INSERT)",
|
includeData: "資料表資料 (INSERT)",
|
||||||
|
standardSqlInsert: "資料表資料使用標準 SQL INSERT",
|
||||||
|
standardSqlInsertDescription: "使用 ANSI 雙引號識別碼和通用純量常值;DDL 與其他物件仍保留來源資料庫方言。",
|
||||||
includeObjects: "檢視 / 預存程序 / 函式 / 序列",
|
includeObjects: "檢視 / 預存程序 / 函式 / 序列",
|
||||||
splitSqlOutput: "將 SQL 匯出分割為 ZIP 壓縮檔",
|
splitSqlOutput: "將 SQL 匯出分割為 ZIP 壓縮檔",
|
||||||
splitSqlPartMaxMb: "每個 SQL 分片的最大大小(MB)",
|
splitSqlPartMaxMb: "每個 SQL 分片的最大大小(MB)",
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ import type {
|
|||||||
TableAdminSqlOptions,
|
TableAdminSqlOptions,
|
||||||
VacuumTableSqlOptions,
|
VacuumTableSqlOptions,
|
||||||
} from "@/lib/database/dbAdminSql";
|
} from "@/lib/database/dbAdminSql";
|
||||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport";
|
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions } from "@/lib/export/databaseExport";
|
||||||
import { loadBrowserAppState, saveBrowserAppState } from "@/lib/backend/browserAppStateStorage";
|
import { loadBrowserAppState, saveBrowserAppState } from "@/lib/backend/browserAppStateStorage";
|
||||||
import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataGrid/dataCompare";
|
import type { DataCompareFromTablesOptions, DataCompareFromTablesPreparation, DataCompareSyncPlan, DataCompareSyncPlanOptions, DataComparePreparation, DataComparePreparationOptions } from "@/lib/dataGrid/dataCompare";
|
||||||
import { apiUrl, apiWebSocketUrl } from "@/lib/common/webPath";
|
import { apiUrl, apiWebSocketUrl } from "@/lib/common/webPath";
|
||||||
@@ -1933,7 +1933,7 @@ export async function buildExportInsertStatements(options: BuildExportInsertStat
|
|||||||
return post("/api/query/build-export-insert-statements", { options });
|
return post("/api/query/build-export-insert-statements", { options });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function buildExportSqlInsert(options: BuildExportInsertStatementsOptions): Promise<string> {
|
export async function buildExportSqlInsert(options: BuildExportSqlInsertOptions): Promise<string> {
|
||||||
return post("/api/query/build-export-sql-insert", { options });
|
return post("/api/query/build-export-sql-insert", { options });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import { decodeMeilisearchDocumentPage, decodeMeilisearchSearchResult, type Meil
|
|||||||
import type { XuguTablespaceInfo } from "@/types/database";
|
import type { XuguTablespaceInfo } from "@/types/database";
|
||||||
import type { CreatedKey, EnqueuedTaskSummary, KeyCreateInput, KeyListItem, KeyPage, KeyUpdateInput, MeilisearchCreateIndexInput, MeilisearchSystemOverview, MeilisearchTask, TaskListInput, TaskPage, TaskSelector } from "@/types/meilisearchManagement";
|
import type { CreatedKey, EnqueuedTaskSummary, KeyCreateInput, KeyListItem, KeyPage, KeyUpdateInput, MeilisearchCreateIndexInput, MeilisearchSystemOverview, MeilisearchTask, TaskListInput, TaskPage, TaskSelector } from "@/types/meilisearchManagement";
|
||||||
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
import type { CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||||
import type { SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
import type { SqlInsertDialect, SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||||
|
|
||||||
/** Normalize Tauri rejections once at the public backend boundary. */
|
/** Normalize Tauri rejections once at the public backend boundary. */
|
||||||
async function invokeBackend<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
async function invokeBackend<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||||
@@ -172,7 +172,7 @@ import type {
|
|||||||
TableAdminSqlOptions,
|
TableAdminSqlOptions,
|
||||||
VacuumTableSqlOptions,
|
VacuumTableSqlOptions,
|
||||||
} from "@/lib/database/dbAdminSql";
|
} from "@/lib/database/dbAdminSql";
|
||||||
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions } from "@/lib/export/databaseExport";
|
import type { BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions } from "@/lib/export/databaseExport";
|
||||||
|
|
||||||
export interface SshPromptResolution {
|
export interface SshPromptResolution {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -2259,7 +2259,7 @@ export async function buildExportInsertStatements(options: BuildExportInsertStat
|
|||||||
return invoke("build_export_insert_statements", { options });
|
return invoke("build_export_insert_statements", { options });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function buildExportSqlInsert(options: BuildExportInsertStatementsOptions): Promise<string> {
|
export async function buildExportSqlInsert(options: BuildExportSqlInsertOptions): Promise<string> {
|
||||||
return invoke("build_export_sql_insert", { options });
|
return invoke("build_export_sql_insert", { options });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5748,6 +5748,7 @@ export interface DatabaseExportRequest {
|
|||||||
failOnError?: boolean;
|
failOnError?: boolean;
|
||||||
preventOverwrite?: boolean;
|
preventOverwrite?: boolean;
|
||||||
outputCompression?: "none" | "gzip";
|
outputCompression?: "none" | "gzip";
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
snapshotSessionId?: string;
|
snapshotSessionId?: string;
|
||||||
batchSize: number;
|
batchSize: number;
|
||||||
splitMaxMb?: number;
|
splitMaxMb?: number;
|
||||||
@@ -5788,6 +5789,7 @@ export interface TableExportRequest {
|
|||||||
filePath: string;
|
filePath: string;
|
||||||
format: "csv" | "xlsx" | "json" | "markdown" | "sql" | "txt";
|
format: "csv" | "xlsx" | "json" | "markdown" | "sql" | "txt";
|
||||||
insertMode?: SqlInsertMode;
|
insertMode?: SqlInsertMode;
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
csvQuoteMode?: CsvQuoteMode;
|
csvQuoteMode?: CsvQuoteMode;
|
||||||
columns?: string[];
|
columns?: string[];
|
||||||
columnTypes?: Array<string | null | undefined>;
|
columnTypes?: Array<string | null | undefined>;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { buildTableSelectSql } from "@/lib/table/tableSelectSql.ts";
|
|||||||
import { uuid } from "@/lib/common/utils.ts";
|
import { uuid } from "@/lib/common/utils.ts";
|
||||||
import { SINGLE_DATABASE_TYPES } from "@/lib/database/databaseCapabilitySets";
|
import { SINGLE_DATABASE_TYPES } from "@/lib/database/databaseCapabilitySets";
|
||||||
import { isXuguSyntheticScope } from "@/lib/sidebar/xuguPublicSynonyms";
|
import { isXuguSyntheticScope } from "@/lib/sidebar/xuguPublicSynonyms";
|
||||||
|
import type { SqlInsertDialect } from "@/lib/export/sqlInsertMode";
|
||||||
|
|
||||||
export const DATABASE_EXPORT_ROW_LIMIT = 10_000;
|
export const DATABASE_EXPORT_ROW_LIMIT = 10_000;
|
||||||
export const DATABASE_EXPORT_PAGE_SIZE = 500;
|
export const DATABASE_EXPORT_PAGE_SIZE = 500;
|
||||||
@@ -31,6 +32,7 @@ export interface BuildDatabaseSqlExportOptions {
|
|||||||
tables: ExportedTableSql[];
|
tables: ExportedTableSql[];
|
||||||
rowLimitPerTable?: number;
|
rowLimitPerTable?: number;
|
||||||
insertBatchSize?: number;
|
insertBatchSize?: number;
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
connectionId?: string;
|
connectionId?: string;
|
||||||
database?: string;
|
database?: string;
|
||||||
schema?: string;
|
schema?: string;
|
||||||
@@ -52,6 +54,10 @@ export interface BuildExportInsertStatementsOptions {
|
|||||||
batchSize?: number;
|
batchSize?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BuildExportSqlInsertOptions extends BuildExportInsertStatementsOptions {
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
|
}
|
||||||
|
|
||||||
export interface BuildExportPageSqlOptions {
|
export interface BuildExportPageSqlOptions {
|
||||||
databaseType?: DatabaseType;
|
databaseType?: DatabaseType;
|
||||||
driverProfile?: string;
|
driverProfile?: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { DatabaseType, QueryResult } from "@/types/database";
|
import type { DatabaseType, QueryResult } from "@/types/database";
|
||||||
import * as api from "@/lib/backend/api";
|
import * as api from "@/lib/backend/api";
|
||||||
import { escapeCsvField, type CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
import { escapeCsvField, type CsvQuoteMode } from "@/lib/export/csvQuoteMode";
|
||||||
import type { SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
import type { SqlInsertDialect, SqlInsertMode } from "@/lib/export/sqlInsertMode";
|
||||||
|
|
||||||
export type ExportCellValue = string | number | boolean | null;
|
export type ExportCellValue = string | number | boolean | null;
|
||||||
|
|
||||||
@@ -45,6 +45,7 @@ export interface FormatSqlInsertOptions {
|
|||||||
spatialValues?: QueryResult["spatial_values"];
|
spatialValues?: QueryResult["spatial_values"];
|
||||||
rows: ExportCellValue[][];
|
rows: ExportCellValue[][];
|
||||||
insertMode?: SqlInsertMode;
|
insertMode?: SqlInsertMode;
|
||||||
|
insertDialect?: SqlInsertDialect;
|
||||||
excludeColumns?: string[];
|
excludeColumns?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import SqlInsertModeDialog from "@/components/export/SqlInsertModeDialog.vue";
|
|||||||
import i18n from "@/i18n";
|
import i18n from "@/i18n";
|
||||||
|
|
||||||
export type SqlInsertMode = "batch" | "single";
|
export type SqlInsertMode = "batch" | "single";
|
||||||
|
export type SqlInsertDialect = "source" | "standard";
|
||||||
|
|
||||||
export interface SqlExportOptions {
|
export interface SqlExportOptions {
|
||||||
insertMode: SqlInsertMode;
|
insertMode: SqlInsertMode;
|
||||||
@@ -10,6 +11,7 @@ export interface SqlExportOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_SQL_INSERT_MODE: SqlInsertMode = "batch";
|
export const DEFAULT_SQL_INSERT_MODE: SqlInsertMode = "batch";
|
||||||
|
export const DEFAULT_SQL_INSERT_DIALECT: SqlInsertDialect = "source";
|
||||||
|
|
||||||
export function showSqlInsertModeDialog(options: { allowSplit?: boolean } = {}): Promise<SqlExportOptions | null> {
|
export function showSqlInsertModeDialog(options: { allowSplit?: boolean } = {}): Promise<SqlExportOptions | null> {
|
||||||
if (typeof document === "undefined") return Promise.resolve({ insertMode: DEFAULT_SQL_INSERT_MODE });
|
if (typeof document === "undefined") return Promise.resolve({ insertMode: DEFAULT_SQL_INSERT_MODE });
|
||||||
|
|||||||
@@ -97,6 +97,20 @@ impl SqlInsertMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// SQL dialect used to render exported INSERT statements.
|
||||||
|
///
|
||||||
|
/// `Source` preserves the database-specific output used by existing exports.
|
||||||
|
/// `Standard` emits portable SQL scalar literals and ANSI-delimited
|
||||||
|
/// identifiers while retaining the source database type for metadata rules
|
||||||
|
/// such as generated-column and synthetic-column omission.
|
||||||
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
|
pub enum SqlInsertDialect {
|
||||||
|
#[default]
|
||||||
|
Source,
|
||||||
|
Standard,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DatabaseExportRequest {
|
pub struct DatabaseExportRequest {
|
||||||
@@ -133,6 +147,8 @@ pub struct DatabaseExportRequest {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub output_compression: DatabaseExportOutputCompression,
|
pub output_compression: DatabaseExportOutputCompression,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
pub insert_dialect: SqlInsertDialect,
|
||||||
|
#[serde(default)]
|
||||||
pub snapshot_session_id: Option<String>,
|
pub snapshot_session_id: Option<String>,
|
||||||
pub batch_size: usize,
|
pub batch_size: usize,
|
||||||
/// When set, the export is packaged as a `.zip` archive containing
|
/// When set, the export is packaged as a `.zip` archive containing
|
||||||
@@ -501,6 +517,8 @@ pub struct BuildExportInsertStatementsOptions {
|
|||||||
pub struct BuildExportSqlInsertOptions {
|
pub struct BuildExportSqlInsertOptions {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub insert: BuildExportInsertStatementsOptions,
|
pub insert: BuildExportInsertStatementsOptions,
|
||||||
|
#[serde(default)]
|
||||||
|
pub insert_dialect: SqlInsertDialect,
|
||||||
/// 生成 INSERT 时需要排除的列名(例如导出时不带主键),忽略大小写匹配。
|
/// 生成 INSERT 时需要排除的列名(例如导出时不带主键),忽略大小写匹配。
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub exclude_columns: Vec<String>,
|
pub exclude_columns: Vec<String>,
|
||||||
@@ -518,6 +536,8 @@ pub struct BuildDatabaseSqlExportOptions {
|
|||||||
pub row_limit_per_table: Option<usize>,
|
pub row_limit_per_table: Option<usize>,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub insert_batch_size: Option<usize>,
|
pub insert_batch_size: Option<usize>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub insert_dialect: SqlInsertDialect,
|
||||||
/// Optional connection info for FK-aware table ordering.
|
/// Optional connection info for FK-aware table ordering.
|
||||||
/// When set, the caller should sort tables by dependency before passing them
|
/// When set, the caller should sort tables by dependency before passing them
|
||||||
/// to `build_database_sql_export`.
|
/// to `build_database_sql_export`.
|
||||||
@@ -537,6 +557,21 @@ pub fn format_export_sql_literal(value: &Value) -> String {
|
|||||||
format_export_sql_literal_for_database(value, None)
|
format_export_sql_literal_for_database(value, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn format_standard_sql_literal(value: &Value) -> String {
|
||||||
|
if value.is_null() {
|
||||||
|
return "NULL".to_string();
|
||||||
|
}
|
||||||
|
if let Some(number) = value.as_number() {
|
||||||
|
return number.to_string();
|
||||||
|
}
|
||||||
|
if let Some(value) = value.as_bool() {
|
||||||
|
return if value { "TRUE" } else { "FALSE" }.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = value.as_str().map_or_else(|| value.to_string(), ToString::to_string);
|
||||||
|
quote_standard_export_sql_string(&text)
|
||||||
|
}
|
||||||
|
|
||||||
fn format_export_sql_literal_for_database(value: &Value, database_type: Option<DatabaseType>) -> String {
|
fn format_export_sql_literal_for_database(value: &Value, database_type: Option<DatabaseType>) -> String {
|
||||||
if value.is_null() {
|
if value.is_null() {
|
||||||
return "NULL".to_string();
|
return "NULL".to_string();
|
||||||
@@ -641,9 +676,7 @@ fn quote_export_sql_string(text: &str) -> String {
|
|||||||
format!("'{}'", text.replace('\\', "\\\\").replace('\'', "''"))
|
format!("'{}'", text.replace('\\', "\\\\").replace('\'', "''"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenGauss exports use standard-conforming strings, so backslashes are
|
fn quote_standard_export_sql_string(text: &str) -> String {
|
||||||
// literal and only embedded single quotes need doubling.
|
|
||||||
fn quote_opengauss_export_sql_string(text: &str) -> String {
|
|
||||||
format!("'{}'", text.replace('\'', "''"))
|
format!("'{}'", text.replace('\'', "''"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +689,7 @@ fn quote_export_sql_string_for_database(text: &str, database_type: Option<Databa
|
|||||||
match database_type {
|
match database_type {
|
||||||
Some(DatabaseType::Dameng) => quote_dameng_export_sql_string(text),
|
Some(DatabaseType::Dameng) => quote_dameng_export_sql_string(text),
|
||||||
Some(DatabaseType::Postgres) => quote_postgres_string_literal(text),
|
Some(DatabaseType::Postgres) => quote_postgres_string_literal(text),
|
||||||
Some(DatabaseType::OpenGauss) => quote_opengauss_export_sql_string(text),
|
Some(DatabaseType::OpenGauss) => quote_standard_export_sql_string(text),
|
||||||
database_type if is_mysql_compatible_export_literal_target(database_type) => {
|
database_type if is_mysql_compatible_export_literal_target(database_type) => {
|
||||||
quote_mysql_compatible_export_sql_string(text)
|
quote_mysql_compatible_export_sql_string(text)
|
||||||
}
|
}
|
||||||
@@ -1185,7 +1218,7 @@ fn is_export_numeric_literal(text: &str) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_export_insert_statements(options: BuildExportInsertStatementsOptions) -> Result<Vec<String>, String> {
|
pub fn build_export_insert_statements(options: BuildExportInsertStatementsOptions) -> Result<Vec<String>, String> {
|
||||||
build_export_insert_statements_excluding(options, &[])
|
build_export_insert_statements_excluding_with_dialect(options, &[], SqlInsertDialect::Source)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 与 [`build_export_insert_statements`] 行为一致,但可以额外按列名排除若干列
|
/// 与 [`build_export_insert_statements`] 行为一致,但可以额外按列名排除若干列
|
||||||
@@ -1196,6 +1229,14 @@ pub fn build_export_insert_statements(options: BuildExportInsertStatementsOption
|
|||||||
pub fn build_export_insert_statements_excluding(
|
pub fn build_export_insert_statements_excluding(
|
||||||
options: BuildExportInsertStatementsOptions,
|
options: BuildExportInsertStatementsOptions,
|
||||||
exclude_columns: &[String],
|
exclude_columns: &[String],
|
||||||
|
) -> Result<Vec<String>, String> {
|
||||||
|
build_export_insert_statements_excluding_with_dialect(options, exclude_columns, SqlInsertDialect::Source)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn build_export_insert_statements_excluding_with_dialect(
|
||||||
|
options: BuildExportInsertStatementsOptions,
|
||||||
|
exclude_columns: &[String],
|
||||||
|
insert_dialect: SqlInsertDialect,
|
||||||
) -> Result<Vec<String>, String> {
|
) -> Result<Vec<String>, String> {
|
||||||
if options.columns.is_empty() || options.rows.is_empty() {
|
if options.columns.is_empty() || options.rows.is_empty() {
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
@@ -1209,6 +1250,7 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
options.table_name.as_deref(),
|
options.table_name.as_deref(),
|
||||||
options.qualified_table_name.as_deref(),
|
options.qualified_table_name.as_deref(),
|
||||||
options.identifier_quote.as_deref(),
|
options.identifier_quote.as_deref(),
|
||||||
|
insert_dialect,
|
||||||
)?;
|
)?;
|
||||||
let spatial_columns =
|
let spatial_columns =
|
||||||
options.spatial_columns.iter().map(|column| (column.column_index, column.srid)).collect::<HashMap<_, _>>();
|
options.spatial_columns.iter().map(|column| (column.column_index, column.srid)).collect::<HashMap<_, _>>();
|
||||||
@@ -1250,11 +1292,13 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
}
|
}
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
let batch_size = if options.database_type.is_some_and(uses_single_row_insert_statements) {
|
let batch_size = if insert_dialect == SqlInsertDialect::Source
|
||||||
|
&& options.database_type.is_some_and(uses_single_row_insert_statements)
|
||||||
|
{
|
||||||
1
|
1
|
||||||
} else {
|
} else {
|
||||||
let requested = options.batch_size.unwrap_or(DATABASE_EXPORT_INSERT_BATCH_SIZE).max(1);
|
let requested = options.batch_size.unwrap_or(DATABASE_EXPORT_INSERT_BATCH_SIZE).max(1);
|
||||||
if options.database_type == Some(DatabaseType::SqlServer) {
|
if insert_dialect == SqlInsertDialect::Source && options.database_type == Some(DatabaseType::SqlServer) {
|
||||||
requested.min(1000)
|
requested.min(1000)
|
||||||
} else {
|
} else {
|
||||||
requested
|
requested
|
||||||
@@ -1263,11 +1307,15 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
let columns = insert_columns
|
let columns = insert_columns
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(_, column, _)| {
|
.map(|(_, column, _)| {
|
||||||
crate::sql_dialect::quote_table_data_identifier(
|
if insert_dialect == SqlInsertDialect::Standard {
|
||||||
options.database_type,
|
crate::sql_dialect::quote_table_identifier(None, column)
|
||||||
column,
|
} else {
|
||||||
options.identifier_quote.as_deref(),
|
crate::sql_dialect::quote_table_data_identifier(
|
||||||
)
|
options.database_type,
|
||||||
|
column,
|
||||||
|
options.identifier_quote.as_deref(),
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ");
|
.join(", ");
|
||||||
@@ -1275,11 +1323,11 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
// Dameng and SQL Server both reject explicit values for identity columns
|
// Dameng and SQL Server both reject explicit values for identity columns
|
||||||
// unless `SET IDENTITY_INSERT <table> ON` wraps the statement (SQL Server
|
// unless `SET IDENTITY_INSERT <table> ON` wraps the statement (SQL Server
|
||||||
// error 544), so exported INSERTs must carry the wrapper.
|
// error 544), so exported INSERTs must carry the wrapper.
|
||||||
let needs_identity_insert_wrapper =
|
let needs_identity_insert_wrapper = insert_dialect == SqlInsertDialect::Source
|
||||||
matches!(options.database_type, Some(DatabaseType::Dameng) | Some(DatabaseType::SqlServer))
|
&& matches!(options.database_type, Some(DatabaseType::Dameng) | Some(DatabaseType::SqlServer))
|
||||||
&& insert_columns.iter().any(|(index, _, _)| {
|
&& insert_columns.iter().any(|(index, _, _)| {
|
||||||
is_identity_column_extra(options.column_extras.get(*index).and_then(|value| value.as_deref()))
|
is_identity_column_extra(options.column_extras.get(*index).and_then(|value| value.as_deref()))
|
||||||
});
|
});
|
||||||
|
|
||||||
// Multi-row batches are written one tuple per line (issue #9814) so exported
|
// Multi-row batches are written one tuple per line (issue #9814) so exported
|
||||||
// `.sql` files stay readable in plain text editors. Statements that hold a
|
// `.sql` files stay readable in plain text editors. Statements that hold a
|
||||||
@@ -1287,9 +1335,10 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
// the "one INSERT per row" output of the single-row insert mode.
|
// the "one INSERT per row" output of the single-row insert mode.
|
||||||
let statement_head = format!("INSERT INTO {table} ({columns}) VALUES");
|
let statement_head = format!("INSERT INTO {table} ({columns}) VALUES");
|
||||||
let statement_prefix = format!("{statement_head} ");
|
let statement_prefix = format!("{statement_head} ");
|
||||||
let statement_overhead_bytes = export_sql_statement_bytes(options.database_type, &statement_prefix) + 1;
|
let output_database_type = if insert_dialect == SqlInsertDialect::Source { options.database_type } else { None };
|
||||||
|
let statement_overhead_bytes = export_sql_statement_bytes(output_database_type, &statement_prefix) + 1;
|
||||||
let target_statement_bytes = DATABASE_EXPORT_TARGET_STATEMENT_BYTES;
|
let target_statement_bytes = DATABASE_EXPORT_TARGET_STATEMENT_BYTES;
|
||||||
let separator_bytes = export_sql_statement_bytes(options.database_type, ",\n");
|
let separator_bytes = export_sql_statement_bytes(output_database_type, ",\n");
|
||||||
let mut current_values = String::new();
|
let mut current_values = String::new();
|
||||||
let mut current_values_bytes = 0usize;
|
let mut current_values_bytes = 0usize;
|
||||||
let mut current_row_count = 0usize;
|
let mut current_row_count = 0usize;
|
||||||
@@ -1331,16 +1380,21 @@ pub fn build_export_insert_statements_excluding(
|
|||||||
.copied()
|
.copied()
|
||||||
.flatten()
|
.flatten()
|
||||||
.or_else(|| spatial_columns.get(index).copied().flatten());
|
.or_else(|| spatial_columns.get(index).copied().flatten());
|
||||||
rendered_row.push_str(&format_export_sql_literal_typed_with_spatial(
|
let literal = if insert_dialect == SqlInsertDialect::Standard {
|
||||||
value,
|
format_standard_sql_literal(value)
|
||||||
options.database_type,
|
} else {
|
||||||
column_type,
|
format_export_sql_literal_typed_with_spatial(
|
||||||
*sqlserver_unicode_string,
|
value,
|
||||||
spatial_srid,
|
options.database_type,
|
||||||
));
|
column_type,
|
||||||
|
*sqlserver_unicode_string,
|
||||||
|
spatial_srid,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
rendered_row.push_str(&literal);
|
||||||
}
|
}
|
||||||
rendered_row.push(')');
|
rendered_row.push(')');
|
||||||
let rendered_row_bytes = export_sql_statement_bytes(options.database_type, &rendered_row);
|
let rendered_row_bytes = export_sql_statement_bytes(output_database_type, &rendered_row);
|
||||||
let candidate_bytes = statement_overhead_bytes
|
let candidate_bytes = statement_overhead_bytes
|
||||||
+ current_values_bytes
|
+ current_values_bytes
|
||||||
+ if current_row_count == 0 { 0 } else { separator_bytes }
|
+ if current_row_count == 0 { 0 } else { separator_bytes }
|
||||||
@@ -1423,8 +1477,12 @@ fn is_postgres_bytea_export_column(database_type: Option<DatabaseType>, column_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_export_sql_insert(options: BuildExportSqlInsertOptions) -> Result<String, String> {
|
pub fn build_export_sql_insert(options: BuildExportSqlInsertOptions) -> Result<String, String> {
|
||||||
build_export_insert_statements_excluding(options.insert, &options.exclude_columns)
|
build_export_insert_statements_excluding_with_dialect(
|
||||||
.map(|statements| statements.join("\n"))
|
options.insert,
|
||||||
|
&options.exclude_columns,
|
||||||
|
options.insert_dialect,
|
||||||
|
)
|
||||||
|
.map(|statements| statements.join("\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_database_sql_export(options: BuildDatabaseSqlExportOptions) -> Result<String, String> {
|
pub fn build_database_sql_export(options: BuildDatabaseSqlExportOptions) -> Result<String, String> {
|
||||||
@@ -1458,20 +1516,24 @@ pub fn build_database_sql_export(options: BuildDatabaseSqlExportOptions) -> Resu
|
|||||||
lines.push(format!("-- Exported rows: {}", table.rows.len()));
|
lines.push(format!("-- Exported rows: {}", table.rows.len()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let inserts = build_export_insert_statements(BuildExportInsertStatementsOptions {
|
let inserts = build_export_insert_statements_excluding_with_dialect(
|
||||||
database_type: table.database_type,
|
BuildExportInsertStatementsOptions {
|
||||||
identifier_quote: table.identifier_quote.clone(),
|
database_type: table.database_type,
|
||||||
schema: table.schema,
|
identifier_quote: table.identifier_quote.clone(),
|
||||||
table_name: table.table_name,
|
schema: table.schema,
|
||||||
qualified_table_name: table.qualified_table_name,
|
table_name: table.table_name,
|
||||||
columns: table.columns,
|
qualified_table_name: table.qualified_table_name,
|
||||||
column_types: table.column_types,
|
columns: table.columns,
|
||||||
column_extras: table.column_extras,
|
column_types: table.column_types,
|
||||||
spatial_columns: table.spatial_columns,
|
column_extras: table.column_extras,
|
||||||
spatial_values: table.spatial_values,
|
spatial_columns: table.spatial_columns,
|
||||||
rows: table.rows,
|
spatial_values: table.spatial_values,
|
||||||
batch_size: Some(insert_batch_size),
|
rows: table.rows,
|
||||||
})?;
|
batch_size: Some(insert_batch_size),
|
||||||
|
},
|
||||||
|
&[],
|
||||||
|
options.insert_dialect,
|
||||||
|
)?;
|
||||||
if inserts.is_empty() {
|
if inserts.is_empty() {
|
||||||
lines.push("-- No rows".to_string());
|
lines.push("-- No rows".to_string());
|
||||||
} else {
|
} else {
|
||||||
@@ -1489,7 +1551,19 @@ fn export_qualified_table_name(
|
|||||||
table_name: Option<&str>,
|
table_name: Option<&str>,
|
||||||
qualified_name: Option<&str>,
|
qualified_name: Option<&str>,
|
||||||
identifier_quote: Option<&str>,
|
identifier_quote: Option<&str>,
|
||||||
|
insert_dialect: SqlInsertDialect,
|
||||||
) -> Result<String, String> {
|
) -> Result<String, String> {
|
||||||
|
if insert_dialect == SqlInsertDialect::Standard {
|
||||||
|
let table_name = table_name
|
||||||
|
.filter(|name| !name.trim().is_empty())
|
||||||
|
.ok_or_else(|| "tableName is required for Standard SQL INSERT output".to_string())?;
|
||||||
|
let table = crate::sql_dialect::quote_table_identifier(None, table_name);
|
||||||
|
return Ok(schema
|
||||||
|
.map(str::trim)
|
||||||
|
.filter(|schema| !schema.is_empty())
|
||||||
|
.map(|schema| format!("{}.{}", crate::sql_dialect::quote_table_identifier(None, schema), table))
|
||||||
|
.unwrap_or(table));
|
||||||
|
}
|
||||||
if let Some(name) = qualified_name.filter(|name| !name.trim().is_empty()) {
|
if let Some(name) = qualified_name.filter(|name| !name.trim().is_empty()) {
|
||||||
return Ok(name.to_string());
|
return Ok(name.to_string());
|
||||||
}
|
}
|
||||||
@@ -2244,6 +2318,7 @@ fn write_database_export_rows<W: Write>(
|
|||||||
table: &str,
|
table: &str,
|
||||||
schema: &str,
|
schema: &str,
|
||||||
db_type: &DatabaseType,
|
db_type: &DatabaseType,
|
||||||
|
insert_dialect: SqlInsertDialect,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let insert_indices = columns
|
let insert_indices = columns
|
||||||
.iter()
|
.iter()
|
||||||
@@ -2293,20 +2368,24 @@ fn write_database_export_rows<W: Write>(
|
|||||||
// Batch database exports do not currently thread a per-connection identifier
|
// Batch database exports do not currently thread a per-connection identifier
|
||||||
// quote through BuildDatabaseSqlExportOptions; Kingbase MySQL-compat users
|
// quote through BuildDatabaseSqlExportOptions; Kingbase MySQL-compat users
|
||||||
// should fall back to the single-table export path which carries the quote.
|
// should fall back to the single-table export path which carries the quote.
|
||||||
let statements = build_export_insert_statements(BuildExportInsertStatementsOptions {
|
let statements = build_export_insert_statements_excluding_with_dialect(
|
||||||
database_type: Some(*db_type),
|
BuildExportInsertStatementsOptions {
|
||||||
identifier_quote: None,
|
database_type: Some(*db_type),
|
||||||
schema: (!schema.is_empty()).then(|| schema.to_string()),
|
identifier_quote: None,
|
||||||
table_name: Some(table.to_string()),
|
schema: (!schema.is_empty()).then(|| schema.to_string()),
|
||||||
qualified_table_name: Some(qualified_table_name),
|
table_name: Some(table.to_string()),
|
||||||
columns: insert_columns.to_vec(),
|
qualified_table_name: Some(qualified_table_name),
|
||||||
column_types: insert_column_types.to_vec(),
|
columns: insert_columns.to_vec(),
|
||||||
column_extras: insert_column_extras.to_vec(),
|
column_types: insert_column_types.to_vec(),
|
||||||
spatial_columns: Vec::new(),
|
column_extras: insert_column_extras.to_vec(),
|
||||||
spatial_values: Vec::new(),
|
spatial_columns: Vec::new(),
|
||||||
rows: insert_rows.to_vec(),
|
spatial_values: Vec::new(),
|
||||||
batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
rows: insert_rows.to_vec(),
|
||||||
})?;
|
batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
||||||
|
},
|
||||||
|
&[],
|
||||||
|
insert_dialect,
|
||||||
|
)?;
|
||||||
for statement in statements {
|
for statement in statements {
|
||||||
writeln!(file, "{statement}\n").map_err(|error| format!("Failed to write file: {error}"))?;
|
writeln!(file, "{statement}\n").map_err(|error| format!("Failed to write file: {error}"))?;
|
||||||
}
|
}
|
||||||
@@ -3688,6 +3767,7 @@ async fn export_database_sql_core_inner(
|
|||||||
table_name,
|
table_name,
|
||||||
&request.schema,
|
&request.schema,
|
||||||
&db_type,
|
&db_type,
|
||||||
|
request.insert_dialect,
|
||||||
)?;
|
)?;
|
||||||
total_rows_exported += rows.len() as u64;
|
total_rows_exported += rows.len() as u64;
|
||||||
on_progress(ExportProgress {
|
on_progress(ExportProgress {
|
||||||
@@ -3804,6 +3884,7 @@ async fn export_database_sql_core_inner(
|
|||||||
table_name,
|
table_name,
|
||||||
&request.schema,
|
&request.schema,
|
||||||
&db_type,
|
&db_type,
|
||||||
|
request.insert_dialect,
|
||||||
)?;
|
)?;
|
||||||
total_rows_exported += row_count as u64;
|
total_rows_exported += row_count as u64;
|
||||||
if use_keyset {
|
if use_keyset {
|
||||||
@@ -4195,8 +4276,9 @@ mod tests {
|
|||||||
sort_export_views_by_dependencies, split_postgres_export_table_triggers, write_database_export_rows,
|
sort_export_views_by_dependencies, split_postgres_export_table_triggers, write_database_export_rows,
|
||||||
BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions,
|
BuildDatabaseSqlExportOptions, BuildExportInsertStatementsOptions, BuildExportSqlInsertOptions,
|
||||||
DatabaseExportObjectCounts, DatabaseExportRequest, DatabaseExportWriter, DdlNormalizeOptions, ExportedTableSql,
|
DatabaseExportObjectCounts, DatabaseExportRequest, DatabaseExportWriter, DdlNormalizeOptions, ExportedTableSql,
|
||||||
PostgresExportExtension, PostgresExportSequence, PostgresExtensionMembers, DATABASE_EXPORT_INSERT_BATCH_SIZE,
|
PostgresExportExtension, PostgresExportSequence, PostgresExtensionMembers, SqlInsertDialect,
|
||||||
DATABASE_EXPORT_ROW_LIMIT, POSTGRES_EXPORT_SEQUENCES_COMPAT_SQL, POSTGRES_EXPORT_SEQUENCES_SQL,
|
DATABASE_EXPORT_INSERT_BATCH_SIZE, DATABASE_EXPORT_ROW_LIMIT, POSTGRES_EXPORT_SEQUENCES_COMPAT_SQL,
|
||||||
|
POSTGRES_EXPORT_SEQUENCES_SQL,
|
||||||
};
|
};
|
||||||
use super::{ExportProgress, LenientExportErrors};
|
use super::{ExportProgress, LenientExportErrors};
|
||||||
use crate::connection::AppState;
|
use crate::connection::AppState;
|
||||||
@@ -4396,12 +4478,38 @@ mod tests {
|
|||||||
fail_on_error: false,
|
fail_on_error: false,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn database_export_request_defaults_to_source_insert_dialect_and_accepts_standard() {
|
||||||
|
let mut payload = json!({
|
||||||
|
"exportId": "export-1",
|
||||||
|
"connectionId": "connection-1",
|
||||||
|
"database": "app",
|
||||||
|
"schema": "dbo",
|
||||||
|
"filePath": "app.sql",
|
||||||
|
"includeStructure": false,
|
||||||
|
"includeData": true,
|
||||||
|
"includeObjects": false,
|
||||||
|
"batchSize": 1000
|
||||||
|
});
|
||||||
|
|
||||||
|
let legacy: DatabaseExportRequest =
|
||||||
|
serde_json::from_value(payload.clone()).expect("deserialize legacy database export request");
|
||||||
|
assert_eq!(legacy.insert_dialect, SqlInsertDialect::Source);
|
||||||
|
|
||||||
|
payload["insertDialect"] = json!("standard");
|
||||||
|
let standard: DatabaseExportRequest =
|
||||||
|
serde_json::from_value(payload).expect("deserialize Standard SQL database export request");
|
||||||
|
assert_eq!(standard.insert_dialect, SqlInsertDialect::Standard);
|
||||||
|
assert_eq!(serde_json::to_value(standard).unwrap()["insertDialect"], json!("standard"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn gzip_export_writer_finishes_a_readable_stream() {
|
fn gzip_export_writer_finishes_a_readable_stream() {
|
||||||
let directory = tempfile::tempdir().unwrap();
|
let directory = tempfile::tempdir().unwrap();
|
||||||
@@ -6057,11 +6165,62 @@ mod tests {
|
|||||||
}))
|
}))
|
||||||
.expect("deserialize export insert payload");
|
.expect("deserialize export insert payload");
|
||||||
|
|
||||||
|
assert_eq!(options.insert_dialect, SqlInsertDialect::Source);
|
||||||
|
|
||||||
let sql = build_export_sql_insert(options).expect("build export sql insert");
|
let sql = build_export_sql_insert(options).expect("build export sql insert");
|
||||||
|
|
||||||
assert_eq!(sql, "INSERT INTO \"public\".\"users\" (\"name\") VALUES ('Ada');");
|
assert_eq!(sql, "INSERT INTO \"public\".\"users\" (\"name\") VALUES ('Ada');");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn standard_sql_insert_uses_ansi_identifiers_and_portable_scalar_literals() {
|
||||||
|
let options: BuildExportSqlInsertOptions = serde_json::from_value(json!({
|
||||||
|
"databaseType": "sqlserver",
|
||||||
|
"identifierQuote": "[",
|
||||||
|
"insertDialect": "standard",
|
||||||
|
"schema": "sales\"ops",
|
||||||
|
"tableName": "order]items",
|
||||||
|
"columns": ["id", "select", "full\"name", "payload"],
|
||||||
|
"columnTypes": ["int", "bit", "nvarchar(100)", "json"],
|
||||||
|
"columnExtras": ["identity(1,1)", null, null, null],
|
||||||
|
"rows": [
|
||||||
|
[1, true, "C:\\tmp\\O'Hara", ["x", 2]],
|
||||||
|
[2, false, "plain", null]
|
||||||
|
],
|
||||||
|
"batchSize": 10
|
||||||
|
}))
|
||||||
|
.expect("deserialize Standard SQL INSERT payload");
|
||||||
|
|
||||||
|
let sql = build_export_sql_insert(options).expect("build Standard SQL INSERT");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
sql,
|
||||||
|
r#"INSERT INTO "sales""ops"."order]items" ("id", "select", "full""name", "payload") VALUES
|
||||||
|
(1, TRUE, 'C:\tmp\O''Hara', '["x",2]'),
|
||||||
|
(2, FALSE, 'plain', NULL);"#
|
||||||
|
);
|
||||||
|
assert!(!sql.contains("IDENTITY_INSERT"));
|
||||||
|
assert!(!sql.contains("N'"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn standard_sql_insert_keeps_requested_batch_mode_for_oracle_sources() {
|
||||||
|
let options: BuildExportSqlInsertOptions = serde_json::from_value(json!({
|
||||||
|
"databaseType": "oracle",
|
||||||
|
"insertDialect": "standard",
|
||||||
|
"schema": "APP",
|
||||||
|
"tableName": "USERS",
|
||||||
|
"columns": ["ID"],
|
||||||
|
"rows": [[1], [2]],
|
||||||
|
"batchSize": 10
|
||||||
|
}))
|
||||||
|
.expect("deserialize Standard SQL INSERT payload");
|
||||||
|
|
||||||
|
let sql = build_export_sql_insert(options).expect("build Standard SQL INSERT");
|
||||||
|
|
||||||
|
assert_eq!(sql, "INSERT INTO \"APP\".\"USERS\" (\"ID\") VALUES\n(1),\n(2);");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn mysql_generated_columns_are_omitted_from_sql_inserts_but_kept_in_ddl() {
|
fn mysql_generated_columns_are_omitted_from_sql_inserts_but_kept_in_ddl() {
|
||||||
let ddl = "CREATE TABLE `orders` (`id` bigint AUTO_INCREMENT, `quantity` int, `unit_price` decimal(10,2), `virtual_total` decimal(10,2) GENERATED ALWAYS AS ((`quantity` * `unit_price`)) VIRTUAL, `stored_total` decimal(10,2) GENERATED ALWAYS AS ((`quantity` * `unit_price`)) STORED);";
|
let ddl = "CREATE TABLE `orders` (`id` bigint AUTO_INCREMENT, `quantity` int, `unit_price` decimal(10,2), `virtual_total` decimal(10,2) GENERATED ALWAYS AS ((`quantity` * `unit_price`)) VIRTUAL, `stored_total` decimal(10,2) GENERATED ALWAYS AS ((`quantity` * `unit_price`)) STORED);";
|
||||||
@@ -6107,6 +6266,7 @@ mod tests {
|
|||||||
}],
|
}],
|
||||||
row_limit_per_table: Some(DATABASE_EXPORT_ROW_LIMIT),
|
row_limit_per_table: Some(DATABASE_EXPORT_ROW_LIMIT),
|
||||||
insert_batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
insert_batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
||||||
|
insert_dialect: SqlInsertDialect::Source,
|
||||||
connection_id: None,
|
connection_id: None,
|
||||||
database: None,
|
database: None,
|
||||||
schema: None,
|
schema: None,
|
||||||
@@ -6146,6 +6306,7 @@ mod tests {
|
|||||||
"orders",
|
"orders",
|
||||||
"shop",
|
"shop",
|
||||||
&DatabaseType::Mysql,
|
&DatabaseType::Mysql,
|
||||||
|
SqlInsertDialect::Source,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
drop(file);
|
drop(file);
|
||||||
@@ -6156,6 +6317,32 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn database_row_writer_forwards_the_standard_insert_dialect() {
|
||||||
|
let directory = tempfile::tempdir().unwrap();
|
||||||
|
let path = directory.path().join("events.sql");
|
||||||
|
let mut file = std::fs::File::create(&path).unwrap();
|
||||||
|
|
||||||
|
write_database_export_rows(
|
||||||
|
&mut file,
|
||||||
|
&[vec![json!(true), json!(r"C:\exports\O'Hara")]],
|
||||||
|
&["enabled".to_string(), "path".to_string()],
|
||||||
|
&[Some("bit".to_string()), Some("nvarchar(255)".to_string())],
|
||||||
|
&[None, None],
|
||||||
|
"event]log",
|
||||||
|
"dbo",
|
||||||
|
&DatabaseType::SqlServer,
|
||||||
|
SqlInsertDialect::Standard,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
drop(file);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
std::fs::read_to_string(path).unwrap(),
|
||||||
|
"INSERT INTO \"dbo\".\"event]log\" (\"enabled\", \"path\") VALUES (TRUE, 'C:\\exports\\O''Hara');\n\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn split_zip_export_writer_splits_across_insert_batches_into_valid_sql() {
|
fn split_zip_export_writer_splits_across_insert_batches_into_valid_sql() {
|
||||||
let directory = tempfile::tempdir().unwrap();
|
let directory = tempfile::tempdir().unwrap();
|
||||||
@@ -6182,6 +6369,7 @@ mod tests {
|
|||||||
"orders",
|
"orders",
|
||||||
"shop",
|
"shop",
|
||||||
&DatabaseType::Postgres,
|
&DatabaseType::Postgres,
|
||||||
|
SqlInsertDialect::Source,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
@@ -6364,6 +6552,7 @@ mod tests {
|
|||||||
}],
|
}],
|
||||||
row_limit_per_table: Some(DATABASE_EXPORT_ROW_LIMIT),
|
row_limit_per_table: Some(DATABASE_EXPORT_ROW_LIMIT),
|
||||||
insert_batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
insert_batch_size: Some(DATABASE_EXPORT_INSERT_BATCH_SIZE),
|
||||||
|
insert_dialect: SqlInsertDialect::Source,
|
||||||
connection_id: None,
|
connection_id: None,
|
||||||
database: None,
|
database: None,
|
||||||
schema: None,
|
schema: None,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ use crate::csv_export::{
|
|||||||
use crate::data_grid_sql::extra_is_auto_generated;
|
use crate::data_grid_sql::extra_is_auto_generated;
|
||||||
pub use crate::database_export::ExportStatus;
|
pub use crate::database_export::ExportStatus;
|
||||||
use crate::database_export::{
|
use crate::database_export::{
|
||||||
build_export_insert_statements_excluding, is_export_cancelled, is_internal_export_column,
|
build_export_insert_statements_excluding_with_dialect, is_export_cancelled, is_internal_export_column,
|
||||||
BuildExportInsertStatementsOptions, SqlInsertMode,
|
BuildExportInsertStatementsOptions, SqlInsertDialect, SqlInsertMode,
|
||||||
};
|
};
|
||||||
use crate::db::agent_driver::AgentTableReadStartParams;
|
use crate::db::agent_driver::AgentTableReadStartParams;
|
||||||
use crate::models::connection::DatabaseType;
|
use crate::models::connection::DatabaseType;
|
||||||
@@ -84,6 +84,8 @@ pub struct TableExportRequest {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub insert_mode: SqlInsertMode,
|
pub insert_mode: SqlInsertMode,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
pub insert_dialect: SqlInsertDialect,
|
||||||
|
#[serde(default)]
|
||||||
pub csv_quote_mode: CsvQuoteMode,
|
pub csv_quote_mode: CsvQuoteMode,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub columns: Option<Vec<String>>,
|
pub columns: Option<Vec<String>>,
|
||||||
@@ -1369,7 +1371,7 @@ async fn try_export_native_table_stream(
|
|||||||
if pending_rows.is_empty() {
|
if pending_rows.is_empty() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let statements = build_export_insert_statements_excluding(
|
let statements = build_export_insert_statements_excluding_with_dialect(
|
||||||
BuildExportInsertStatementsOptions {
|
BuildExportInsertStatementsOptions {
|
||||||
database_type: Some(*db_type),
|
database_type: Some(*db_type),
|
||||||
identifier_quote: request.identifier_quote.clone(),
|
identifier_quote: request.identifier_quote.clone(),
|
||||||
@@ -1385,6 +1387,7 @@ async fn try_export_native_table_stream(
|
|||||||
batch_size: Some(request.insert_mode.batch_size(SQL_INSERT_BATCH_SIZE)),
|
batch_size: Some(request.insert_mode.batch_size(SQL_INSERT_BATCH_SIZE)),
|
||||||
},
|
},
|
||||||
&sql_export_excluded_columns(request, primary_keys, col_names, column_extras),
|
&sql_export_excluded_columns(request, primary_keys, col_names, column_extras),
|
||||||
|
request.insert_dialect,
|
||||||
)?;
|
)?;
|
||||||
if !statements.is_empty() {
|
if !statements.is_empty() {
|
||||||
if wrote_statements {
|
if wrote_statements {
|
||||||
@@ -2217,7 +2220,7 @@ async fn export_table_data_core_inner(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let statements = build_export_insert_statements_excluding(
|
let statements = build_export_insert_statements_excluding_with_dialect(
|
||||||
BuildExportInsertStatementsOptions {
|
BuildExportInsertStatementsOptions {
|
||||||
database_type: Some(db_type),
|
database_type: Some(db_type),
|
||||||
identifier_quote: request.identifier_quote.clone(),
|
identifier_quote: request.identifier_quote.clone(),
|
||||||
@@ -2233,6 +2236,7 @@ async fn export_table_data_core_inner(
|
|||||||
batch_size: Some(request.insert_mode.batch_size(SQL_INSERT_BATCH_SIZE)),
|
batch_size: Some(request.insert_mode.batch_size(SQL_INSERT_BATCH_SIZE)),
|
||||||
},
|
},
|
||||||
&sql_export_excluded_columns(request, &primary_keys, &col_names, &column_extras),
|
&sql_export_excluded_columns(request, &primary_keys, &col_names, &column_extras),
|
||||||
|
request.insert_dialect,
|
||||||
)?;
|
)?;
|
||||||
if !statements.is_empty() {
|
if !statements.is_empty() {
|
||||||
if wrote_statements {
|
if wrote_statements {
|
||||||
@@ -2307,8 +2311,8 @@ mod tests {
|
|||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn table_export_request_defaults_to_batch_insert_mode() {
|
fn table_export_request_defaults_to_source_dialect_and_batch_insert_mode() {
|
||||||
let request: TableExportRequest = serde_json::from_value(json!({
|
let mut payload = json!({
|
||||||
"exportId": "export-1",
|
"exportId": "export-1",
|
||||||
"connectionId": "conn-1",
|
"connectionId": "conn-1",
|
||||||
"database": "db",
|
"database": "db",
|
||||||
@@ -2316,10 +2320,18 @@ mod tests {
|
|||||||
"tableName": "users",
|
"tableName": "users",
|
||||||
"filePath": "users.sql",
|
"filePath": "users.sql",
|
||||||
"format": "sql"
|
"format": "sql"
|
||||||
}))
|
});
|
||||||
.expect("deserialize table export request");
|
let request: TableExportRequest =
|
||||||
|
serde_json::from_value(payload.clone()).expect("deserialize table export request");
|
||||||
|
|
||||||
assert_eq!(request.insert_mode, SqlInsertMode::Batch);
|
assert_eq!(request.insert_mode, SqlInsertMode::Batch);
|
||||||
|
assert_eq!(request.insert_dialect, SqlInsertDialect::Source);
|
||||||
|
|
||||||
|
payload["insertDialect"] = json!("standard");
|
||||||
|
let request: TableExportRequest =
|
||||||
|
serde_json::from_value(payload).expect("deserialize Standard SQL table export request");
|
||||||
|
assert_eq!(request.insert_dialect, SqlInsertDialect::Standard);
|
||||||
|
assert_eq!(serde_json::to_value(request).unwrap()["insertDialect"], json!("standard"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@@ -2415,6 +2427,7 @@ mod tests {
|
|||||||
file_path: output.to_string_lossy().into_owned(),
|
file_path: output.to_string_lossy().into_owned(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: Some(vec!["id".to_string(), "name".to_string()]),
|
columns: Some(vec!["id".to_string(), "name".to_string()]),
|
||||||
column_types: Some(vec![Some("INTEGER".to_string()), Some("VARCHAR".to_string())]),
|
column_types: Some(vec![Some("INTEGER".to_string()), Some("VARCHAR".to_string())]),
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2580,6 +2593,7 @@ mod tests {
|
|||||||
file_path: output.to_string_lossy().into_owned(),
|
file_path: output.to_string_lossy().into_owned(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
csv_quote_mode: CsvQuoteMode::All,
|
csv_quote_mode: CsvQuoteMode::All,
|
||||||
exclude_primary_keys: false,
|
exclude_primary_keys: false,
|
||||||
columns: None,
|
columns: None,
|
||||||
@@ -2748,6 +2762,7 @@ mod tests {
|
|||||||
file_path: "device2.csv".to_string(),
|
file_path: "device2.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2809,6 +2824,7 @@ mod tests {
|
|||||||
file_path: "device2.csv".to_string(),
|
file_path: "device2.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2848,6 +2864,7 @@ mod tests {
|
|||||||
file_path: "device2.csv".to_string(),
|
file_path: "device2.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2882,6 +2899,7 @@ mod tests {
|
|||||||
file_path: "device2.csv".to_string(),
|
file_path: "device2.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2924,6 +2942,7 @@ mod tests {
|
|||||||
file_path: "samples.csv".to_string(),
|
file_path: "samples.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -2978,6 +2997,7 @@ mod tests {
|
|||||||
file_path: "events.csv".to_string(),
|
file_path: "events.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -3026,6 +3046,7 @@ mod tests {
|
|||||||
file_path: "orders.txt".to_string(),
|
file_path: "orders.txt".to_string(),
|
||||||
format: "txt".to_string(),
|
format: "txt".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -3102,6 +3123,7 @@ mod tests {
|
|||||||
file_path: "order.csv".to_string(),
|
file_path: "order.csv".to_string(),
|
||||||
format: "csv".to_string(),
|
format: "csv".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -3160,6 +3182,7 @@ mod tests {
|
|||||||
file_path: "spatial_data.sql".to_string(),
|
file_path: "spatial_data.sql".to_string(),
|
||||||
format: "sql".to_string(),
|
format: "sql".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
@@ -3220,6 +3243,7 @@ mod tests {
|
|||||||
file_path: "users.sql".to_string(),
|
file_path: "users.sql".to_string(),
|
||||||
format: "sql".to_string(),
|
format: "sql".to_string(),
|
||||||
insert_mode: Default::default(),
|
insert_mode: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
columns: None,
|
columns: None,
|
||||||
column_types: None,
|
column_types: None,
|
||||||
column_extras: None,
|
column_extras: None,
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ impl BackupService {
|
|||||||
} else {
|
} else {
|
||||||
DatabaseExportOutputCompression::None
|
DatabaseExportOutputCompression::None
|
||||||
},
|
},
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: Some(snapshot.session_id.clone()),
|
snapshot_session_id: Some(snapshot.session_id.clone()),
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ async fn run_database_export_of_partition_tree_has_no_duplicates_and_replays() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ async fn run_database_export_writes_structure_and_data_for_all_tables() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -330,6 +330,7 @@ async fn live_postgres_backup_snapshot_exports_wide_jsonb_then_next_table_inner(
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: Some(snapshot.session_id.clone()),
|
snapshot_session_id: Some(snapshot.session_id.clone()),
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -445,6 +446,7 @@ async fn live_postgres_backup_snapshot_cancel_interrupts_pending_row_inner() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: Some(snapshot.session_id.clone()),
|
snapshot_session_id: Some(snapshot.session_id.clone()),
|
||||||
batch_size: 1,
|
batch_size: 1,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -562,6 +564,7 @@ async fn live_mysql_database_backup_refreshes_an_idle_snapshot_before_export() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: Some(snapshot.session_id.clone()),
|
snapshot_session_id: Some(snapshot.session_id.clone()),
|
||||||
batch_size: 100,
|
batch_size: 100,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ async fn live_mysql_database_export_restores_dependent_views() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -293,6 +294,7 @@ async fn run_live_mysql_database_export_handles_many_tables_including_empty_tabl
|
|||||||
fail_on_error: false,
|
fail_on_error: false,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -388,6 +390,7 @@ async fn live_mysql_database_export_creates_missing_destination_directory() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -465,6 +468,7 @@ async fn live_mysql_database_export_refuses_to_recreate_a_destination_that_disap
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
@@ -553,6 +557,7 @@ async fn live_mysql_database_export_refuses_a_destination_that_vanished_before_i
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ async fn live_mysql_database_export_table_order_is_not_alphabetical_when_fk_reor
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ async fn live_postgres_all_schema_export_restores_one_sql_file() {
|
|||||||
fail_on_error: true,
|
fail_on_error: true,
|
||||||
prevent_overwrite: false,
|
prevent_overwrite: false,
|
||||||
output_compression: Default::default(),
|
output_compression: Default::default(),
|
||||||
|
insert_dialect: Default::default(),
|
||||||
snapshot_session_id: None,
|
snapshot_session_id: None,
|
||||||
batch_size: 1000,
|
batch_size: 1000,
|
||||||
split_max_mb: None,
|
split_max_mb: None,
|
||||||
|
|||||||
Reference in new issue
Block a user