a._dash
a._dash

Reputation: 11

Adding comment to a column in DolphinDB table

I want to add a comment column to an existing table. How can I do this?

Thanks!

Upvotes: 0

Views: 29

Answers (1)

shishis24
shishis24

Reputation: 11

If I understand the question correctly, you may want to use the setColumnComment function (which adds comments to table columns);

For example,

db=database("dfs://db1")
payroll=table(take(1..10, 100) as id, rand(36+1..10, 100) as time, take(5000 5500 6000 6500, 100) as wage)
dt123=db.createTable(payroll,`dt123).append!(payroll)

setColumnComment(dt123, {time:"time card hours", wage:"wage(dollar)"})

Then use function schema to view column comments.

schema(dt123).colDefs 

name typeString typeInt comment        
---- ---------- ------- ---------------
id   INT        4                      
time INT        4       time card hours
wage INT        4       wage(dollar)   

Upvotes: 1

Related Questions