|
|
@@ -72,12 +72,13 @@ func (f *DorisFactory) InsertCSV(database, table, csvData string, skipHeader boo
|
|
72
|
72
|
|
|
73
|
73
|
url := fmt.Sprintf("http://%s:%d/api/%s/%s/_stream_load", f.FEHost, f.FEPort, database, table)
|
|
74
|
74
|
|
|
|
75
|
+ fmt.Print(url)
|
|
|
76
|
+
|
|
75
|
77
|
// 使用 resty 的 API
|
|
76
|
78
|
resp, err := f.client.R().
|
|
77
|
79
|
SetBasicAuth(f.Username, f.Password).
|
|
78
|
|
- SetHeader("Content-Type", "text/plain").
|
|
79
|
|
- SetHeader("format", "csv").
|
|
80
|
|
- SetHeader("column_separator", ",").
|
|
|
80
|
+ SetHeader("column_separator", ","). // 必需
|
|
|
81
|
+ SetHeader("enclose", "\"").
|
|
81
|
82
|
SetBody(csvData).
|
|
82
|
83
|
Put(url)
|
|
83
|
84
|
|