Search code examples
sqlpartitionkdb

Update in partitioned table


I am trying to update a null value to 0f so it can be used for aggregation.

The following is my code:

update x:0f from data where date=2016.07.01,null x;

but it didn't work on a partitioned table, how am I able to update on a partitioned table?


Solution

  • The "par" error occurs when you try to update a partitioned table, which you can't do like that. Instead you have to generate the updated column and write back to disk.

    If you're doing this to all date slices, your best bet might be to use the "fncol" function in the dbmaint utilities (https://github.com/KxSystems/kdb/blob/master/utils/dbmaint.md) to apply a function to the column throughout history. For example

    fncol[`:/path/to/db;`data;`x;0f^]