2018.12.19 12:52 AM
2018.12.20 06:03 AM
2019.03.26 02:17 AM
Cheers, Mathias
I'm not sure what you mean by preserving the schema, if each document has a different schema how do you plan to store them if they don't conform to a common schema?On your point about .Q.fps, the easiest way to figure out what to do with the stream of data is to extract out a chunk and inspect it, like so:.Q.fps[{$[not `global in key `.;`global set x;()]};`:/path/to/myFIFO]Then you can inspect the global to see what a chunk of the stream looks like.Terry
2019.03.26 12:26 PM
Something like this might work for you,though it may not be the most efficient
q)tmp:.j.k .j.j orig:([]col1:`aa`bb`cc;col2:11 22 33i;col3:.z.D-til 3;col4:1 2 3h)
q)clms:`col1`col2`col3`col4;
q)types:"SIDH";
q)t:flip clms!types$\:();
q)`t upsert {@[x;y;{$[0h=type y;x$y;("h"$.Q.t?lower x)$y]}z]}/[tmp;cols tmp;types];
q)t~orig
1b
/or in your example (assuming you've defined a types variable):
`item upsert {@[x;y;{$[0h=type y;x$y;("h"$.Q.t?lower x)$y]}z]}/[z;cols z;types]
2019.04.03 08:03 AM
2019.04.05 07:07 AM
2019.04.05 07:16 AM
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.