在创建分布式表时提示A stream table does not support direct access

我想把从流数据表订阅的数据保存到DolphinDB分布式表,代码如下:

share streamTable(1000000:0,`hardwareId`ts`temp1`temp2`temp3,[INT,TIMESTAMP,DOUBLE,DOUBLE,DOUBLE]) as sensorTemp
enableTablePersistence(sensorTemp, true, false, 1000000)

db1 = database("",VALUE,2018.08.14..2018.12.20)db2 = database("",RANGE,0..10*100)db = database("dfs://iotDemoDB",COMPO,[db1,db2])
db.createPartitionedTable(sensorTemp,"sensorTemp",`ts`hardwareId)
subscribeTable(, "sensorTemp", "save_to_db", -1, append!{dfsTable}, true, 1000000, 10)

但在GUI中执行代码时,报错。

2020.10.10 10:45:28.024: executing code ...
dfsTable = ::createPartitionedTable(db, sensorTemp, "sensorTemp", ["ts","hardwareId"]) => A stream table does not support direct access. Please use sql query to retrieve data

请问各位大佬该如何解决?


请先 登录 后评论

1 个回答

Juntao Wang

需要修改一下createPartitionedTable的第2个参数:

tableSchema=table(1:0,`hardwareId`ts`temp1`temp2`temp3,[INT,TIMESTAMP,DOUBLE,DOUBLE,DOUBLE]) 
dfsTable = db.createPartitionedTable(tableSchema,"sensorTemp",`ts`hardwareId)
请先 登录 后评论