KDB / KX adds table to file without reading the whole file
I am new to KDB (sorry if this question is dumb). I am creating the following table
q)dsPricing:([id:`int$(); date:`date$()] open:`float$();close:`float$();high:`float$();low:`float$();volume:`int$())
q)dsPricing:([id:`int$(); date:`date$()] open:`float$();close:`float$();high:`float$();low:`float$();volume:`int$())
q)`dsPricing insert(123;2003.03.23;1.0;3.0;4.0;2.0;1000)
q)`dsPricing insert(123;2003.03.24;1.0;3.0;4.0;2.0;2000)
q)save `:dsPricing
Let's say after saving, I exit. After running q I would like to add another pricing clause without downloading the whole file because the file can be large
q)`dsPricing insert(123;2003.03.25;1.0;3.0;4.0;2.0;1500)
I have looked at .Q.dpft but I cannot figure it out. Also this table / file does not need to be split.
thank
+3
source to share
1 answer
You can activate the table file descriptor to add to disk, your example would look like this:
`:dsPricing upsert(123;2003.03.25;1.0;3.0;4.0;2.0;1500)
You can load the table into your q session using get, load or \ l
q)get `:dsPricing
id date | open close high low volume
--------------| --------------------------
123 2003.03.23| 1 3 4 2 1000
123 2003.03.24| 1 3 4 2 2000
123 2003.03.25| 1 3 4 2 1500
... Q.dpft stores the table splayed (one file for each column in the table and .d file containing column names) with the divided attribute (p #) symbol on one of the columns. Any character columns will also be listed . Q.en .
+5
source to share