Migrating PyKX 3.* to KDB-X Python 4.*
KDB-X
KDB-X is the evolution of kdb+. For full details and to obtain the public preview go here.
KDB-X Python is the evolution of PyKX. This change will allow the Python library more closely develop alongside the KDB-X platform. New features to KDB-X will be quickly and fully integrated into the KDB-X Python library.
- KDB-X Python operates using KDB-X.
Note: KDB-X Python is under active development, as such this version has the b tag denoting its beta status.
KDB-X configuration changes
For a full list of changes and additions in KDB-X see here. Below is a subset which directly effect KDB-X Python:
QCFGconfiguration option has been added.- Defaults to
~/.kx/configif this file exists.
- Defaults to
- The current working directory is no longer checked for a license.
- Only
QLICandQHOMEwill be checked.
- Only
.z.vhas been added to theZContextwhich holds initialisation values forversion,QCFG,QHOME,QLIC, andQINIT.
KDB-X Python configuration changes
- The default configuration file is
config-pykx, no longer.pykx-config. PYKX_CONFIGURATION_LOCATIONnow points to a file, not a folder. A user can user a different file name to the default if they wish.- The search path for a configuration file is
PYKX_CONFIGURATION_LOCATIONif it is set, then~/.kx/config-pykxif it exists. .and~are no longer searched for a config file.kx.util.add_to_configchanges:- An optional
profileargument to specify which profile configuration values should saved to has been added.- This defaults to
kx.config.pykx_config_profileto pick up any prevailing value set by the user. - If no value is chosen the default is
default
- This defaults to
- The optional
folderargument has been replaced withfile:- This defaults to
kx.config.pykx_config_locationto pick up a prevailing valid file if in use. - If
pykx_config_locationis empty a new file~/.kx/config-pykxwill be created.
- This defaults to
- Added arguments are no longer added to
os.environ, they are only added to the configuration file.
- An optional
kx.util.install_qchanges:- An optional
config_fileargument has been added. Defaults topykx_config_location. - An optional
config_profileargument has been added. Defaults topykx_config_profile.
- An optional
PYKX_4_1_ENABLEDconfiguration option has been removed.- The NEP-49 allocator now defaults to on to support zero copy conversions when possible.
PYKX_ALLOCATORconfiguration option has been removed.PYKX_NO_ALLOCATORhas been added if you wish to opt out of this behaviour.--pykxallocentry forQARGS/qcommand line has been removed.--pykxnoallochas been added if you wish to opt out of this behaviour.
Loading of cloud libraries
Previously 4 cloud libraries were loading by default upon import kurl, objstor, qlog, sql.
To speed up imports and avoid error and warning messages for users these have moved from opt-out to opt-in.
-
PYKX_NOQCEenvironment variable has been removed and replaced withPYKX_QCE. -
QARGScommand line options have also changed:--no-qcehas been removed and replaced with--qce.--no-kurlhas been removed and replaced with--kurl.--no-objstorhas been removed and replaced with--objstor.--no-qloghas been removed and replaced with--qlog.--no-sqlhas been removed and replaced with--sql.
SQL
- KDB-X now embeds it's SQL interface directly rather than it being loaded from a different file (
s.k_). - To have it fully initialised a user has several options:
- Use any of
QARGS="--qce",QARGS="--sql",PYKX_QCE=Trueas detailed above. - From Python, the first call to
kx.q.sqlautomatically loads the interface. - From q, call
.s.init[]or make a query starting withs)which will automatically load the SQL interface on first use.
- Use any of
- If a user has code directly calling a
.sfunction by name (.e.g.s.e), they need to ensure to load the interface before these calls are run.
Other
- A default value for secondary threads is no longer set. To add secondary threads pass
QARGS="-s N"or add an entrys=Nto yourQCFG.
Release Notes
KDB-X Python 4.0.0b5
Release Date: 2025-02-09
- Moves to KDB-X 5.0.20260122.
- Includes bug fixes from PyKX 3.1.6 and PyKX 3.1.7.
-
New
VirtualTableclass for use with Parquet module:>>> import pykx as kx >>> from pathlib import Path >>> pq = kx.q.use('kx.pq') >>> t = pq['pq'](Path('types.parquet')) >>> t pykx.VirtualTable(pykx.q('`T!`f`m`t!(k){[f;t;c;b;a;v]g:$[s:-1h=@b;0;#b];(bf;b1):$[g;df[t;0,0b;b];(::;()..')) >>> t.select() pykx.Table(pykx.q(' col0 col1 col2 --------------- 1 1 "asd" 1 2 "bsd" 0 3 "csd" 1 4 "asd" 0 5 "bsd" 0 6 "csd" 1 7 "asd" 0 8 "bsd" 0 9 "csd" ')) >>> t.select(kx.Column('col1').max(), by=kx.Column('col2')) pykx.KeyedTable(pykx.q(' col2 | col1 -----| ---- "asd"| 7 "bsd"| 8 "csd"| 9 '))
KDB-X Python 4.0.0b4
Release Date: 2025-11-17
- Moves to KDB-X 5.0.20251114.
- Includes bug fixes from PyKX 3.1.5.
KDB-X Python 4.0.0b3
Release Date: 2025-09-30 (expires 2026-01-04)
- Moves to KDB-X 0.1.1.
KDB-X Python 4.0.0b2
Release Date: 2025-07-30 (expires 2025-09-30)
- Removes
invalid escape sequencewarnings upon import for some users. - Turns on NumPy allocator by default.
- Replaces
PYKX_ALLOCATORwithPYKX_NO_ALLOCATOR - Replaces
--pykxallocwith--pykxnoalloc
- Replaces
- Includes bug fixes from PyKX 3.1.4.
- Fixed an issue where data could be corrupted in keyed columns of PyArrow-backed Pandas dataframes.
- Resolved
object has no attribute 't'error for certain conversions.
KDB-X Python 4.0.0b1
Release Date: 2025-07-02 (expires 2025-09-30)
- Initial release. Uses KDB-X 0.1.0.