fix: export table task dir
This commit is contained in:
@@ -48,6 +48,14 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// mkdir if not exist
|
||||
if _, err = os.Stat(params.FilePath); os.IsNotExist(err) {
|
||||
err = os.MkdirAll(params.FilePath, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Error("Failed to Mkdir:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
//duration = params.Duration
|
||||
|
||||
// 查询数据
|
||||
@@ -71,7 +79,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
params.Columns, params.TableName, params.TimeCol, params.Duration, unitNum, params.TimeCol, params.Duration, unitNum)
|
||||
}
|
||||
|
||||
log.Trace("query:", query)
|
||||
//log.Trace("query:", query)
|
||||
//filePath := fmt.Sprintf("%s/%s_export_%s.csv", params.FilePath, params.TableName, time.Now().Format("20060102150405"))
|
||||
filePath := fmt.Sprintf("%s/%s_export_%s.csv", params.FilePath, params.TableName, time.Now().Format("20060102150405"))
|
||||
affected, err := s.exportData(query, filePath)
|
||||
|
||||
Reference in New Issue
Block a user