Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

dolphindb中怎么设置字段的comment?

我在dolphindb中创建了一个表,怎么设置字段的comment?

db=database("dfs://db1",VALUE,1 2 3)
timestamp = [09:34:07,09:36:42,09:36:51,09:36:59,09:32:47,09:35:26,09:34:16,09:34:26,09:38:12]
sym = `C`MS`MS`MS`IBM`IBM`C`C`C
price= 49.6 29.46 29.52 30.02 174.97 175.23 50.76 50.32 51.29                        
qty = 2200 1900 2100 3200 6800 5400 1300 2500 8800                                
t = table(timestamp, sym, qty, price)
dt=db.createTable(t,`dt).append!(t)
dt.schema().colDefs ;

返回:
image
现在是空的,我想增加字段的comment,应该怎么做?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

DolphinDB中setColumnComment函数可以给分布式表的列添加注释。
上面的例子可以执行下面的代码给表的列增加注释:

setColumnComment(dt,{sym:"股票代码",qty:"交易量",price:"价格"})

然后执行:

loadTable("dfs://db1","dt").schema().colDefs

可以看到注释已经添加成功:
image


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...