如下的例子里:如果要在csv文件里加一列TradeDate怎么实现
建议使用textChunkDS 函数来导入,这样大文件会被切分为数据源,不会单次事务占用过大内存
例子:
def writeData(files, dirPath, dbName, tbName){
login("admin", "123456")
pt = loadTable(dbName, tbName)
for(file in files ){
filePath = dirPath+"/"+file
print(filePath)
schemaTB = table(pt.schema().colDefs.name as name, pt.schema().colDefs.typeString as type)
try{ds = textChunkDS(filePath,512,",",schemaTB)
mr(ds, append!{pt},,,false)
}
catch(ex){print(ex)}
}
}