kdb

kdb splayed table meta error


I have a splayed table which I can select data from just fine.

When I try to view the meta data I get a `sym error. Can anyone suggest reasons why this might happen?

 q)meta tablename
 k){$[(20h>t)|77h<t:@x;`;98h>@. t:!x;`;t]}
 'sym
 .:
 `sym
 q.Q))

Solution

  • You are getting error because enumerated sym file is missing. Normally Q interpreter looks it into one directory above splayed directory.

    For ex: If you give a save command like this:

           q)  t:([]sym:`a`b;id:1 2)
    
           q) `:/home/test/t/ set .Q.en[`:test] t
    

    It will create directory 't' inside /home/test for splayed table 't' and create enumerated 'sym' file in directory /home/test.

    To load this table:

           q)\l /home/test
    

    Other thing is, you can also load enumerated 'sym' file manually like this:

           q)sym:get `:path to sym file
    

    All tables in memory will automatically get mapped to this new list.

    Reference: http://code.kx.com/q4m3/14_Introduction_to_Kdb+/#1422-splayed-tables-with-symbol-columns