如何给已经建好的流数据表增加一列?

在dolphindb中,我已经建好了一个流数据表,也已经写入了一些数据。但是由于业务的扩展,我现在需要增加一列,有办法吗?

以下面的代码为例,我创建了一个只有x列的流数据表,但是我现在想增加一列y列,请问该怎么办?

n=10
ticker = rand(`MSFT`GOOG`FB`ORCL`IBM,n)
x=rand(1.0, n)
t=streamTable(ticker, x)
share t as st
请先 登录 后评论

1 个回答

Jax Wu

DolphinDB中的addColumn(table, colNames, colTypes)可以给分布式表或流数据表添加新的列。
具体的例子如下:

n=10
ticker = rand(`MSFT`GOOG`FB`ORCL`IBM, n)
x=rand(1.0, n)
t=streamTable(ticker, x)
share t as st

addColumn(st,["price", "qty"],[DOUBLE, INT])
insert into st values("MSFT", 12.0, 25.46, 256)
select * from st;
请先 登录 后评论