Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDB: How to use KDB Function in Python?

I want to execute a KDB function within a Python Script. The KDB function is contained in a separate Q file though. So how can I read in this Q file and then query a function from within that Q file in Python?

like image 565
Riley Hun Avatar asked Feb 07 '26 00:02

Riley Hun


1 Answers

You can use PyQ to call q into Python; a quick start guide is linked here . You can follow the instructions for installation and prompting q according to this link, then load in your script via the method shown in the example below.

Note: You should use the executable pyq rather than python to start.

$ pyq
>>> from pyq import q
>>> q()
q) \l /path/to/script.q
q) \
>>> x = q.f(arg1, arg2)
>>> x.show()

Hope that helps!

like image 124
R. Laidler Avatar answered Feb 08 '26 12:02

R. Laidler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!