I have a splayed table with a folder structure
myroot/
2023.01.01
mytable
col1
col2
...
.d
2023.01.02
...
...
sym
looking at the documentation of upsert
x upsert y
Overwrite or append records to a table where x is a table, or the name of a table as a symbol atom, or the name of a splayed table as a directory handle
However it appears to expect sym
and .d
to be on the folder the file handle points to, but they are in different folders.
How can I append the data?
The sym file sym
(for enumeration) and column order file .d
should never be in the same folder, kdb+ won't expect this.
You should be able append to a table in your database by using .Q.en
to enumerate the data, assuming the database has been loaded first and the data you are trying to append is a table.
/ load database
\l myroot
/ enumerate data and upsert
`:2023.01.01/mytable/ upsert .Q.en[`sym]data
If the data to append is in the format of list of records to insert then the following should work (provided the correct schema is used):
`:2023.01.01/mytable/ upsert (`sym?`XYZ;.z.p;0.1;0.1;1;1)
Alternatively if you can't or don't wish to load the entire database you just need to bring the sym
file in to memory before enumerating and appending.
sym:get[`:myroot/sym]