Syntax:
.Q.dpft[d;p;f;t]
.Q.dpfts[d;p;f;t;s]
.Q.dpt[d;p;t]
.Q.dpts[d;p;t;s]
Where
d is a directory handlep is a partition of a databasef a field of the table named byt, the name (as a symbol) of a simple table whose columns are vectors or compound listss is the handle of a symtablesaves t splayed to partition p.
It also rearranges the columns of the table so that the column specified by f is second in the table
(the first column in the table will be the virtual column determined by the partitioning e.g. date).
Returns the table name if successful.
q)trade:([]sym:10?`a`b`c;time:.z.T+10*til 10;price:50f+10?50f;size:100*1+10?10)
q).Q.dpft[`:db;2007.07.23;`sym;`trade]
`trade
q)delete trade from `.
`.
q)trade
'trade
q)\l db
q)trade
date sym time price size
-----------------------------------------
2007.07.23 a 11:36:27.972 76.37383 1000
2007.07.23 a 11:36:27.982 77.17908 200
2007.07.23 a 11:36:28.022 75.33075 700
2007.07.23 a 11:36:28.042 58.64531 200
2007.07.23 b 11:36:28.002 87.46781 800
2007.07.23 b 11:36:28.012 85.55088 400
2007.07.23 c 11:36:27.952 78.63043 200
2007.07.23 c 11:36:27.962 90.50059 400
2007.07.23 c 11:36:27.992 73.05742 600
2007.07.23 c 11:36:28.032 90.12859 600
If you are getting an 'unmappable error, you can identify the offending columns and tables:
/ create 2 example tables
q)t:([]a:til 2;b:2#enlist (til 1;10)) / bad table, b is unmappable
q)t1:([]a:til 2;b:2#til 1) / good table, b is mappable
q)helper:{$[(type x)or not count x;1;t:type first x;all t=type each x;0]};
q)select from (raze {([]table:enlist x;columns:enlist where not helper each flip .Q.en[`:.]`. x)} each tables[]) where 0<count each columns
table columns
-------------
t b
.Q.dpfts allows the enum domain to be specified. Since V3.6 (2018.04.13)
q)show t:([]a:10?`a`b`c;b:10?10)
a b
---
c 8
a 1
b 9
b 5
c 4
a 6
b 6
c 1
b 8
c 5
q).Q.dpfts[`:db;2007.07.23;`a;`t;`mysym]
`t
q)mysym
`c`a`b