Home › Forums › kdb+ › How to add a column to the Partition table? › Re: How to add a column to the Partition table?
-
You haven’t added the rk column to the 2023.06.01 partition.
q){x!`rk in/:get each` sv/:(hsym`$string x),:`trade`.d}date 2023.06.01| 0 2023.06.02| 0 2023.06.05| 1 2023.06.06| 1
You can reference dbmaint.q – it contains utility functions for working on partitioned databases. For this case, the fixtable function would help you here – adding the rk column into the partitions that don’t currently contain it.
In general, better practice is to add the empty column to all partitions first (addcol), and then write down the partitions containing data. This keeps the HDB in a good state throughout the operation.