cancel
Showing results for 
Search instead for 
Did you mean: 

IPC

ngumbo
New Contributor II

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.

1 ACCEPTED SOLUTION

pmallon
New Contributor III
New Contributor III

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

View solution in original post

2 REPLIES 2

pmallon
New Contributor III
New Contributor III

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

ngumbo
New Contributor II

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!