3 删除dolphindb表的指定行

想要删除表中某一列为空的记录,但是似乎不支持,报告异常 It is not allowed to delete rows from tables other than basic in-memory tables and segmented in-memory tables.

dolphindb应该如何删除单行记录?

delete from trades where isNull(symbol)
请先 登录 后评论

1 个回答

Jason Tang - 时序数据库技术支持

测试版本:1.30.9 2021.05.17

注意:dfs表的delete、update从1.30.6版本才开始支持

内存表的删除方法:

t = table(1 2 3 as id, 4 NULL 6 as v1, 7..9 as v2)
delete from t where isNull(v1)

dfs表的删除方法:

if(existsDatabase("dfs://hashdb")){
    dropDatabase("dfs://hashdb")
}
db = database("dfs://hashdb", HASH,  [INT, 2])
t = table(1 2 3 as id, 4 NULL 6 as v1, 7..9 as v2)
pt = db.createPartitionedTable(t, `pt, `id)
pt.append!(t)
delete from loadTable("dfs://hashdb", `pt) where isNull(v1)
请先 登录 后评论