Saving a keyed table to disk

Hi,Is there a way to save a keyed table to disk?I went through the documentation, but everywhere I looked, it spokeabout the table necessarily had to be a non-keyed table.These were some of the references1. .Q.dpft https://code.kx.com/trac/wiki/DotQ/DotQDotdpft2. .Q.en https://code.kx.com/trac/wiki/Cookbook/SplayedTables#EnumeratingvarcharcolumnsinatableRegards,Nav

X-Mailer: Apple Mail (2.930.3)just save it as single file.On 7 May 2009, at 18:03, Nav wrote:>> Hi,>> Is there a way to save a keyed table to disk?>> I went through the documentation, but everywhere I looked, it spoke> about the table necessarily had to be a non-keyed table.>> These were some of the references>> 1. .Q.dpft https://code.kx.com/trac/wiki/DotQ/DotQDotdpft\> 2. .Q.en https://code.kx.com/trac/wiki/Cookbook/ > SplayedTables#Enumeratingvarcharcolumnsinatable>> Regards,> Nav> >

If you really want it splayed, unkey it first:

/ A is your keyed table
A:0!A;
.Q.dpft[`:.;.z.D;`sym;`A]

When you want to work with the table, simply xkey or ! it after loading it. This does not have the desired effect (i.e. all rows for all partitions keyed), but natively q does not support this except as in Felix’s solution, which is the best for small tables. Keep in mind though that writing static binary files to disk will require them to be completely loaded back into memory before usage.

Hi,I am currenlty using Felix’s solution and storing files ( one file foreach symbol ). Some of the symbol names have special charactersincluding ‘#’ and ‘$’. While storing data for these symbols, using setkdb+ is throwing an error. How do I escape the special characters .For instance, if Nav# is a symbol, I do this, `:/path/Nav# set trade.For this, kdb+ throws an error.Please advice.Regards,Nav

X-Mailer: Apple Mail (2.935.3)On 13.05.2009, at 14:03, Nav wrote:> I am currently using Felix’s solution and storing files ( one file for> each symbol ). Some of the symbol names have special characters> including ‘#’ and ‘$’. While storing data for these symbols, using set> kdb+ is throwing an error. How do I escape the special characters .>> For instance, if Nav# is a symbol, I do this, `:/path/Nav# set trade.> For this, kdb+ throws an error.the column names have to be valid q variable names, so you can’t use special charactersfirst letter in a-zA-Z, thereafter a-zA-Z0-9 and if you must "_"avoid names in .Q.res (res <-> reserved) as well - calling a column “select” will not end well