unenumerate a column in hdb

459 views
Skip to first unread message

Dal Mon

unread,
Nov 26, 2008, 11:53:57 AM11/26/08
to Kdb+ Personal Developers
Is there a way to un-enumerate a column in the hdb? One of these
columns is causing the sym file to grow out of control.

Manish Patel

unread,
Nov 26, 2008, 5:30:58 PM11/26/08
to personal...@googlegroups.com
you'll need to cast it to a string - use dbmaint.q from kx site
i don't think you can unenumerate unless you write out a whole new list of course 

Lindqvist

unread,
Nov 27, 2008, 2:08:26 PM11/27/08
to Kdb+ Personal Developers
If you want to roll your own, something along the lines (for all dates
of course) should work.
You should test it against a dev DB that you can mess up first of
course!

As another posted noted though, dbmaint should be able to do this just
fine...

/ Splayed HDB
hdb: "/path/to/hdb/"
hhdb: hsym `$hsym

dates: (key hhdb) where (key hhdb) like "[0-9][0-9][0-9][0-9].[0-9]
[0-9].[0-9][0-9]"

{[dat; tableName; colName]
-1 "Amending date: ",string date;
/ hsym to column
col: hsym `$(string date),"/",(string tableName),"/",colName;

/ Column attributes
a: attr col;

/ read column, cast to string, apply attributes and write back to
disk
col set a#string get col;
}[;"table";"badCol"] each dates;
Reply all
Reply to author
Forward
0 new messages