KX Community

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

Home Forums kdb+ How the sym file reads data from partition table?

  • How the sym file reads data from partition table?

    Posted by hzadonis369 on February 20, 2023 at 12:00 am

    Hi, Masters:

      Last week, I created a partition table to store fundmental data, for example, Sector A has 10 equities and Sector B has 8 equities. The data changed day by day and was loaded by a csv file which exported from Stock Exchange system. It works fine last week.
      As you know, Feb 18 and 19 is weekend. Today, Feb 20 is Monday, there’s trouble. The same script that imports csv file into kdb partition table has problem. The Sector data was disrupted, I tested with a temp table, such as:
      sect:(” SS”; enlist “,”) 0:`E:/App/datafile/Sector.csv;
      But after write to parition table it is totally different from the temp table:
      (hsym `$parSectorpath) set .Q.en[hsym `$dbpath, “;”] sect;
      l E:/App/db
      At the same time, there’s a strange folder named “db;” which contains a sym file was generated under the App path.
     I try to use the sym file to replace the old one, the historical data and today’s data are all disrupted, because the number of Sector is not the same as last week. So, can I sure it was caused by the sym file? How can I fix it?
    Thanks!
    hzadonis369 replied 9 months, 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • gyorokpeter-kx

    Member
    February 20, 2023 at 12:00 am

    Why do you have  `$dbpath, “;” ? If dbpath is “db” then that would explain why you are seeing a “db;” directory.

    This way, the sym file from this operation is created in the “db;” directory, and the symbol indices in the table will point to this new sym file. You can’t swap in and out sym files with each other if there are existing symbol references to it, because then they will point to the wrong symbol. Instead you could load the “wrong” sym file, de-enumerate the symbol columns, and then call .Q.en again but this time with the correct database path.

  • hzadonis369

    Member
    February 20, 2023 at 12:00 am

    Hi, gyorokpeter-kx: Thanks! you’re right. It’s stupid that add a “;” at the end of “dbpath”.   It’s works fine now!

Log in to reply.