KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Loading sym in a namespace

  • Loading sym in a namespace

    Posted by jackyyuk on April 15, 2025 at 5:07 am

    Hello,

    I am trying to load some data from KDB table:

    q) sym:get  `:/data/sym</p><p>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</p><p>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

    mwoods replied 3 days, 11 hours ago 2 Members · 1 Reply
  • 1 Reply
  • mwoods

    Administrator
    April 15, 2025 at 10:11 am

    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

Log in to reply.