Reputation: 2785
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?
Upvotes: 3
Views: 1950
Reputation: 765
Depending on what exactly you are trying to accomplish, qPython might be an alternative... It allows you to connect/subscribe to a kdb server from within a python script, run q code, queries, etc...
https://pypi.org/project/qPython/
Upvotes: 0
Reputation: 649
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!
Upvotes: 5