(ps - this gives additional output that just shows you what is actually being ran).
(pps - this will not create the newdir folder, if not there already. You can use normal mkdir commands and/or use the kdb+ system command “cd” to create it if required)
As much as above will do what you requested, are you sure you want to do this?
A splayed table is saved to disk in a folder, the folder name representing the table name, and each file representing the columns, with the exception of the .d file which is a symbol list of the columns of that table.
When running this function above(and going by your requirements), you are moving all columns from dir to newDir. This can overwrite some of the previous columns that were already there. Are both sets of column files the same length now? If not, you will have a jagged splay, and hit errors further on down the line when querying. Are you updating the .d file to include the newly copied files? If not, your kdb+ process will never recognise these newly copied columns as actual columns in the splayed table, and so they are made redundant. Just some things to think about..
Btw - I’d rather not get into it here on this thread, and hopefully you already are aware, but the naming conventions of your columns, and table names go against several kdb+ principles.
Once again, thank you for your quick reply. It’s very helpful, as always. And what a “tell off” :)
I am just learning kbd+/q and there are many aspects of kdb+ which I am still not familiar with. For now, this will do. Unfortunately, most of the time it is not the best approach…
As you say, all cols are moved to one folder. Indeed, the /.d file in that folder is updated every time; all cols are empty - I am creating one absolutely massive empty splayed table which I will be filling in at next stage.
All the problems I have right now come from the size of the files I work with. This is my way around this, not necessarily the best, but its working for now. I hope my kdb+ skills will get better soon.
Good shout about the the naming - I will correct it now as I need col names to be valid identifiers. Thank you.
Hi Sean,
Sorry but your suggestion does not seem to work, if I understand it correctly. When I try it, it does nothing. Do you mind checking it please?