Wednesday, January 21, 2015

kdb load csv into splayed table with column type of character string (not symbol)

// using string, ie list of char, instead of symbol for some feedcode
// since domain is not limited with growing expiries
// http://code.kx.com/wiki/JB:KdbplusForMortals/splayed_tables#1.2.7.3_Symbols_vs._Strings
// note that the entire symbol file is loaded into memory

// To load csv into table of list type, use *
(::)Cols:("SNHS*SH"; "|") 0:`$"/text/file.pipe"
//(::)t: flip ColNames!Cols
// .Q.en is to enumerate the symbol columns
`:/kdb/2000.01.01/table/ set .Q.en[`:/kdb;] flip ColNames!Cols
delete Cols from `.

// load the splayed table
\l /kdb

No comments:

Post a Comment