KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
190 stars 49 forks source link

.z.pi not working in pyq #93

Closed zak-b2c2 closed 4 years ago

zak-b2c2 commented 5 years ago

Questions

Steps to reproduce the issue

Hello, it seems .z.pi does not work in pyq. Below is just a dummy example:

ubuntu@host:~$ q
q)cnt:0
q).z.pi:{ cnt::cnt+1 ; show value x;};
q)cnt
1
q)cnt
2
q)1+1
2
q)3+4
7
q)cnt
5
q)\\
ubuntu@host:~$ workon venv
(venv) ubuntu@host:~$ pyq
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> q()
q)cnt:0
q).z.pi:{ cnt::cnt+1 ; show value x;};
q)cnt
0
q)1+1
2
q)cnt
0
q)\
>>> 

Expected result

I expect variable cnt to increase at each call

Actual result

cnt does not increase at each call

Workaround

N/A If you know workaround, please provide it here.

sashkab commented 5 years ago

q) prompt in the PyQ is pseudo-prompt and does not support all features of kdb+ prompt. It was created to simplify debugging.

I will leave it to @abalkin to decide if this feature can be enhanced to support .z.pi.

zak-b2c2 commented 5 years ago

Thanks for the answer, indeed it's what I expected. The reason I want to override .z.pi is because I have sandbox environments for my user which they can spin up themselves, and I would like to log all queries.

github-actions[bot] commented 4 years ago

Stale issue message

xiangpeng2008 commented 3 years ago

do we support .z.pi nowadays ? it's very useful to custom output, such as add colors, etc.