Skip to content

Python integration

Python integration requires embedPy

KX Analyst has usability integrations with Python through the use of embedPy. If embedPy is installed in the kdb+ process Analyst is running in, users can enable Python integration from the File > User Settings menu in Analyst.

Once Python integration is enabled, and embedPy is installed and loaded (using \l p.q), the following integrations will be available.

Interactive editor

Any open .py or .p files in Analyst are interactive in a similar way to regular q editors. At any point, Python text can be selected and run by using the editor context-menu or hotkey.

Move data between kdb+ and Python

Moving data between the q and Python execution environments can be done directly through the embedPy API, or through the Analyst UI as follows:

In the Process View tab of the Analyst sidebar, any selected data can be sent to the Python environment through the sidebar context-menu as seen below.

Editors

Once the Python integrations are enabled, expressions can be assigned to either execution environment through the use of the editor context-menus.

If in a q editor, select an expression or variable and select Set Variable in Python.

If in a Python editor, the same can be done to move data to q as seen in the interactive editor.

Python support FAQ

See the embedPy FAQ for information relating to Python support, particularly around data type compatibility between Python and q.