perf(export): stream large SQL INSERT exports in background
This commit is contained in:
1 parent
a77e089848
commit
c8b4224587
14 files changed
+1047
-38
No files matched your search
@@ -306,7 +306,7 @@ interface DataGridProps {
|
||||
exportSql?: string;
|
||||
onExecuteSql?: (sql: string) => Promise<void>;
|
||||
fullExportResult?: (onProgress?: (info: { rowsExported: number; totalRows: number | null }) => void) => Promise<QueryResult | undefined>;
|
||||
queryResultExportRequest?: (options: { exportId: string; filePath: string; format: "csv" | "xlsx" | "txt"; includeSqlSheet?: boolean }) => Promise<api.QueryResultExportRequest | undefined>;
|
||||
queryResultExportRequest?: (options: { exportId: string; filePath: string; format: "csv" | "xlsx" | "txt" | "sql"; includeSqlSheet?: boolean; exportTableName?: string; exportColumnTypes?: Array<string | null | undefined> }) => Promise<api.QueryResultExportRequest | undefined>;
|
||||
allExportResults?: Array<{ sheetName: string; result: QueryResult; sql?: string }>;
|
||||
exportFileBaseName?: string;
|
||||
customSaveHandler?: import("@/composables/useDataGridEditor").CustomSaveHandler;
|
||||
@@ -1760,8 +1760,8 @@ const tableColumnTypesByName = computed(() => {
|
||||
}
|
||||
return map;
|
||||
});
|
||||
const visibleColumnTypes = computed(() =>
|
||||
visibleColumnIndexes.value.map((index) =>
|
||||
const allColumnTypes = computed(() =>
|
||||
props.result.columns.map((_, index) =>
|
||||
resolveResultColumnType({
|
||||
resultColumnType: props.result.column_types?.[index],
|
||||
resultColumnName: props.result.columns[index]?.toLocaleLowerCase(),
|
||||
@@ -1770,6 +1770,7 @@ const visibleColumnTypes = computed(() =>
|
||||
}),
|
||||
),
|
||||
);
|
||||
const visibleColumnTypes = computed(() => visibleColumnIndexes.value.map((index) => allColumnTypes.value[index]));
|
||||
const visibleColumnCount = computed(() => visibleColumnIndexes.value.length);
|
||||
|
||||
const numericColumnRightAlign = computed(() => (settingsStore.editorSettings.numericColumnRightAlign ?? true) && !showTranspose.value);
|
||||
@@ -5182,6 +5183,7 @@ const {
|
||||
sourceColumns: visibleSourceColumns,
|
||||
mongoDocuments: computed(() => props.result.mongo_copy_documents ?? props.result.mongo_documents),
|
||||
columnTypes: visibleColumnTypes,
|
||||
allColumnTypes,
|
||||
whereInput: computed(() => currentWhereInput()),
|
||||
orderBy: computed(() => currentOrderBy()),
|
||||
exportBatchSize: computed(() => settingsStore.editorSettings.exportBatchSize),
|
||||
|
||||
@@ -1353,7 +1353,9 @@ defineExpose({ focusSearch, refreshData, refreshQueryEditorCompletionCache, hand
|
||||
:total-row-count-loading="activeTab.resultTotalRowCountLoading"
|
||||
:on-execute-sql="async (sql: string) => emit('executeSql', sql)"
|
||||
:full-export-result="(onProgress?: (info: { rowsExported: number; totalRows: number | null }) => void) => queryStore.fetchTabResultForExport(activeTab.id, onProgress)"
|
||||
:query-result-export-request="(options: { exportId: string; filePath: string; format: 'csv' | 'xlsx' | 'txt'; includeSqlSheet?: boolean }) => queryStore.buildQueryResultExportRequest(activeTab.id, options)"
|
||||
:query-result-export-request="
|
||||
(options: { exportId: string; filePath: string; format: 'csv' | 'xlsx' | 'txt' | 'sql'; includeSqlSheet?: boolean; exportTableName?: string; exportColumnTypes?: Array<string | null | undefined> }) => queryStore.buildQueryResultExportRequest(activeTab.id, options)
|
||||
"
|
||||
:all-export-results="allResultExportSheets"
|
||||
:export-file-base-name="activeTab.title"
|
||||
@update:order-by-input="(v: string) => (activeTab.orderByInput = v)"
|
||||
|
||||
Reference in new issue
Block a user