2015.04.28 02:11 PM
2015.04.29 01:23 AM
2015.04.29 06:50 AM
Looks like this is because you are trying to partition on the 'date' column which in this case is type z (float based) which is invalid.
You can only partition on certain data types - date, int, month.
You'll need to add a suitably typed column on which to partition before trying to use .Q.dcfgnt
Sean
2015.04.29 05:12 PM
Hello guys, when I use .Q.dcfgnt (http://code.kx.com/wiki/Cookbook/LoadingFromLargeFiles ) to do the partitioned data for my csv file, I got a problem: this script can read the "D" type value, but cannot read the "Z" type value. I was thinking to change something in the script, but after many times of tests, it doesn't work. Therefore, is anybody who can help me fix this? Appreciate very much!
I put the online script here: - I need to put "ZFFFFIS" rather than "DFFFFIS" in the last steps; then it cannot work. I've added one thing such as the following: , but it said "d"$c wrong type...
/k)dcfgnt:{[d;c;f;g;n;t]*p if[10>0;c:"d"$c;dpfgnt[d;;f;g;n]'?[t;;0b;()]',:'(=;c;)'p:?[; ();();c]?[t;();1b;(,c)!,c]]}
.Q.dcfgnt sripts are:
------------------------------------------------------------ ------------------------------ ----------------------
\d .Q
/ extension of .Q.dpft to separate table name & data
/ and allow append or overwrite
/ pass table data in t, table name in n, : or , in g
k)dpfgnt:{[d;p;f;g;n;t]if[~&/qm'r:+en[d]t;'`unmappable];
{[d;g;t;i;x]@[d;x;g;t[x]i]}[d:par[d;p;n];g;r;<r f]'!r;
@[;f;`p#]@[d;`.d;:;f,r@&~f=r:!r];n}
/ generalization of .Q.dpfnt to auto-partition and save a multi-partition table
/ pass table data in t, table name in n, name of column to partition on in c
k)dcfgnt:{[d;c;f;g;n;t]*p dpfgnt[d;;f;g;n]'?[t;;0b;()]',:'(=;c;)'p:?[;();();c]?[t;(); 1b;(,c)!,c]}
\d .
r:flip`date`open`high`low`close`volume`sym!("DFFFFIS";", ")0:
w:.Q.dcfgnt[`:dbo;`date;`sym;,;`stats]
.Q.fs[w r@]`:file.csv
2015.04.30 12:34 AM
2015.04.30 09:33 AM
try P (timestamp type)Cheers,Attila
2015.04.30 10:06 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.