// using mysql as an example
// perhaps a good way to just have parsed output (say from perl) to directly go into kdb
q)(::)test:("*TH"; enlist "\t") 0:system "mysql -u root -e 'select \"string\" str, time(now()) time, 99 short from dual' "
str time short
---------------------------
"string" 15:55:11.000 99
q)meta test
c | t f a
-----| -----
str | C
time | t
short| h
Wednesday, January 28, 2015
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
// 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
Subscribe to:
Posts (Atom)