2022.03.01 04:55 AM
Hey Team,
I'm currently working through IPC and am working on creating a query log table to store all queries done on a process. I am attempting to modify .z.pi so that for each query ran in q it updates a query table. This is my current query:
.z.pi:{ `queryTable insert (.z.ts; enlist string x) ; value x}
While this adds queries to the table it does not carry out the operation on the q command line. Is this the right way to approach this sort of task ? Any alternatives would be appreciated if not.
2022.03.01 05:20 AM
Hi,
I think you might want to use .z.ps/.z.pg for this, does the below do what you want?
q)admin:([]query:();time:`timestamp$();user:`$();handle:`int$())
q).z.ps:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x;}
q).z.pg:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x}
q)0 (+;1;2) / run on local p
q)admin
query time user handle
--------------------------------------------------
+ 2022.03.01D13:14:16.858901000 pm 0
2022.03.01 05:20 AM
Hi,
I think you might want to use .z.ps/.z.pg for this, does the below do what you want?
q)admin:([]query:();time:`timestamp$();user:`$();handle:`int$())
q).z.ps:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x;}
q).z.pg:{`admin upsert enlist ( x 0;.z.p;.z.u;.z.w);value x}
q)0 (+;1;2) / run on local p
q)admin
query time user handle
--------------------------------------------------
+ 2022.03.01D13:14:16.858901000 pm 0
2022.03.01 06:56 AM
Yes this is more or less what I was looking for Thanks a million! I got in my head that .z.pi was essential thanks for clearing that up!
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.