要使用 DataX (DATAX-OPENSOURCE-3.0) 和 DolphinDBWriter (130.21.5) 将数据导入到 DolphinDB,我将以下脚本添加到配置 JSON 文件中:
"saveFunctionName": "savePartitionedData1",
"saveFunctionDef": "
def rowUpdate(dbName, tbName, data, t){
dfsPath = dbName
temp = select * from t
update temp set trade_dt = datetimeParse(trade_dt,"yyyyMMdd")
loadTable(dfsPath, tbName).append!(temp)}
def savePartitionedData1(dbName, tbName, data){
dfsPath = dbName
login(\"admin\",\"123456\")
t = loadTable(dfsPath, tbName)
ds1 = sqlDS(<select * from t>)
mr(ds1, rowUpdate{dbName, tbName, data})
} "
但是出现错误:
Server response: 'savePartitionedData1: mr(ds1, rowUpdate{dbName, tbName, data}) => The type of some tuple elements is not DATASOURCE' function: 'savePartitionedData1{'dfs://stock_daily_TSDB','ashareeodprices'}'
。
如何在 DolphinDB 中解决这个问题?
您可以直接更新原表的数据,并使用
append!
函数将数据追加到新表中。尽量不要使用mr
功能。