Command to check partitioned directory in KDB

两盒软妹~` 提交于 2019-12-11 03:22:09

问题


I have one 'q' service running. I want to check whether current directory in the service is a partitioned directory or not. Is there any command to do that?


回答1:


https://code.kx.com/q/ref/dotq/#qpf-partition-type or one of the other .Q's should do it for you (https://code.kx.com/q/ref/card/#q). Though KX don't necessarily recommend using .Q utilities.

Another way would be to check for the existence of the variable "date" (if date-partitioned), which lists the available partitioned dates. Assuming there hasn't been a random unrelated global "date" variable created in the process.




回答2:


You can check if par.txt exists in db root (current working directory usually) - this may be a better alternative to relying on something internal within .Q namespace, which is subject to change (although Kx rarely makes breaking changes to it).

So for a partitioned HDB, you'd get the following:

q) `par.txt in key`:.
      1b


来源:https://stackoverflow.com/questions/25629666/command-to-check-partitioned-directory-in-kdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!