Loading sym in a namespace

https://learninghub.kx.com/forums/topic/loading-sym-in-a-namespace

Hello,

I am trying to load some data from KDB table:

q) sym:get  `:/data/sym

q) select ASymCol from `:/data/2024.01.01/tbl


In the above example, AsymCol is in a type of `sym$(...), where the corresponding sym file is located in  `:/data/sym, and everything works properly.

But if I do this in a namespace:

q) \d .Mynamespace

q.Mynamespace) sym:get `:/data/sym

q.Mynamespace) select ASymCol from `:/data/2024.01.01/tbl

The returned ASymCol simply shows integer values instead of the symbol from sym.

Is there anyway to assign the sym to the proper sym value?

I also unable to assign any value to a variable at root namespace. Is there anyway to do that?


Thanks so much.


Jacky


To assign a root variable from within a namespace without leaving it you can use upsert or insert and the symbol `.. notation to refer to root namespace:

`..sym upsert get `:/data/sym