QStudio
Query kdb+ Servers and Chart Results.
Article updated 2024-08-27.
Kola was released 2023 and is the fastest most modern kdb+ python API.
I would strong recommend Kola as your chosen API unless you have a strong reason to choose an alternative.
Article updated 2023-05-15. You now have two main options:
Library | License | Last Updated | Website | Description | Python Versions Supported |
---|---|---|---|---|---|
Kola | Open Source | 2023 | Site | Python Polars Interface to kdb+/q written in rust language, is released to Linux/macOS/Windows.
Authored by Jo Shinonome. More info.. |
3.8 to 3.12 |
qPython3 | Open - Apache2 | 2023 | site | qPython is a Python library providing support for interprocess communication between Python and kdb+ processes
Synchronous and asynchronous queries, kdb+ v4.0 |
2.7 3.6 3.9 3.10* and numpy 1.8+ |
PyKX | Closed / Commercial | 2023 | site | Brings Python and Q interpreters in the same process
allows code written in either of the languages to operate on the same data. Seems to be kx's successor to PyQ, however where pyq was apache license, PyKX is commerical. |
2.7 3.9 3.10* |
PyQ | Open - Apache2 | 2020 | site | Brings Python and Q interpreters in the same process
allows code written in either of the languages to operate on the same data. |
2.7 3.9 3.10* |
Python Library |
Open | 2013 | site | Python interface for querying kdb servers, successor to qpy.
Not updated in 10 years. |
2.4 2.7 |
Open | 2010 | site | First Python interface for querying kdb servers, modeled after the Java interface. | 2.7 |
Dans Python Library can be downloaded here.
Successor to qpy, this library is based heavily on it. It is quicker than qpy
however you are unable to easily display tables. Daniel is no longer actively maintaining it but does accept bug fixes, there are no plans to support v3.x of Python.
2017 Update from Dan
For anyone else who needs a Python library, I am highly recommending the exxeleron qpython library (though it does require numpy, which requires 2.6 As a minimum, I believe, which can be a limitation)
qpy can be downloaded here.
Originally developed back in 2009 qpy is easy to setup and contained within one Python module.
You can display tables in the Python command line with ease however it is no longer under development and can be slow if displaying a lot of data.
qpy's successor is Daniel Nugent's Q.
print conn.k('select from table') #for example
when receiving tables
When accessing a couple of thousands of rows it can be quite slow, if that is a common occurrence you may wish to use another Python interface. However, in general it is best to avoid using Python and write your functions in Q, only later transferring the specific data to Python.
Loads python as a dynamic library inside of kdb, allows entering code in either language using shared memory and data.
As recommended on Kx's Wiki page. If you are using a non Linux platform, it requires more effort to get up and running as you will need to compile it for a specific platform. PyQ can pre-compile Q queries and reuse them to speed up processing. But it is still recommended to minimise the computing done in Python, regardless of library being used, as Python is consierably slower than Q.
Install instructions are available here.
Query kdb+ Servers and Chart Results.