Skip to content

Commit 5847bf5

Browse files
authored
refactor: use csvWithNames as format for export-csv (#528)
* refactor: use csvWithNames as format for export-csv * feat: format
1 parent c961164 commit 5847bf5

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/api/editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const writeInfluxDB = (data: string, precision: string) => {
144144

145145
const runSQLWithCSV = (code: string, format?: string): Promise<HttpResponse> => {
146146
const params = addDatabaseParams()
147-
params.params.format = format || 'csv'
147+
params.params.format = format || 'csvWithNames'
148148
return axios.post(sqlUrl, makeSqlData(code), params)
149149
}
150150

src/api/interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ axios.interceptors.response.use(
8787
return Promise.reject(errorResponse)
8888
}
8989
if (isV1) {
90-
if (response.config.params && response.config.params.format === 'csv') {
90+
if (response.config.params?.format?.includes('csv')) {
9191
return response.data || []
9292
}
9393
response.data = JSONbigint({ storeAsString: true }).parse(response.data)

src/views/dashboard/query/editor.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ a-card.editor-card(:bordered="false")
387387
const exportCsv = async () => {
388388
try {
389389
secondaryCodeRunning.value = true
390-
const res = await exportWithFormat(currentStatement.value, promForm, 'csv')
390+
const res = await exportWithFormat(currentStatement.value, promForm, 'csvWithNames')
391391
fileDownload(res, `export_${queryType.value}_greptimedb.csv`)
392392
Message.success('Exported successfully')
393393
} catch (error) {
@@ -429,20 +429,20 @@ a-card.editor-card(:bordered="false")
429429
]
430430
431431
const placeholder = `Paste response from explain analyze format json here. Example format:
432-
{
433-
"output": [
434-
{
435-
"records": {
436-
"schema": {
437-
"column_schemas": []
438-
},
439-
"rows": [],
440-
"total_rows": 0
432+
{
433+
"output": [
434+
{
435+
"records": {
436+
"schema": {
437+
"column_schemas": []
438+
},
439+
"rows": [],
440+
"total_rows": 0
441+
}
441442
}
442-
}
443-
],
444-
"execution_time_ms": 0
445-
}`
443+
],
444+
"execution_time_ms": 0
445+
}`
446446
</script>
447447

448448
<style lang="less" scoped>

0 commit comments

Comments
 (0)