KDB-X Python Migration from PyKX
This page outlines the key changes that affect developers moving from PyKX 3. to KDB-X Python 4.. It covers updated configuration behavior, new defaults, deprecated options, and important differences in how SQL, threading, and cloud libraries load.
KDB-X and Python integration
KDB-X builds on kdb+ with a modern platform foundation. Get KDB-X and full platform details.
KDB-X Python replaces PyKX and now evolves directly alongside the KDB-X platform. New KDB-X features integrate rapidly and completely into the Python library.
- KDB-X Python operates using KDB-X.
- Status: actively developed; marked with a
btag to indicate beta
KDB-X configuration changes
For a full list of changes and additions in KDB-X, refer to the release notes. The section below highlights updates that directly impact KDB-X Python:
- Added
QCFGconfiguration option. If the file~/.kx/configexists, KDB-X uses it by default. - Updated license lookup behavior. KDB-X no longer checks the current working directory for a license. It now only checks
QLICandQHOME. - Added
.z.vto theZContextwhich holds initialization values for:version,QCFG,QHOME,QLIC, andQINIT.
KDB-X Python configuration changes
Configuration file location
- Replaced the default config file
.pykx-configwithconfig-pykx. PYKX_CONFIGURATION_LOCATIONnow points to a file, not a folder.- Users can set a custom filename.
- KDB-X Python searches in this order:
1.
PYKX_CONFIGURATION_LOCATION(if set) 2.~/.kx/config-pykx(if it exists) - KDB-X Python no longer searches
.or~for a configuration file.
kx.util.add_to_config changes
- Added a
profileargument to specify the profile that should receive configuration values. - Defaults to
kx.config.pykx_config_profile. - Uses
defaultif no profile is set. - Replaced the folder argument with file.
- Defaults to
kx.config.pykx_config_location. - If unset, creates a new file at
~/.kx/config-pykx. - The function no longer adds values to
os.environ. It writes only to the configuration file.
kx.util.install_q changes
- Added a
config_fileargument (defaults topykx_config_location). - Added a
config_profileargument (defaults topykx_config_profile).
Removed or replaced options
- Removed
PYKX_4_1_ENABLEDconfiguration option. - Enabled the
NEP-49allocator by default to support zero-copy conversions. - Removed
PYKX_ALLOCATOR - Added
PYKX_NO_ALLOCATORto allow users to opt out - Removed
--pykxalloc(QARGS/q command-line option) - Added
--pykxnoallocas the new opt-out flag
Library loading and command-line changes
Cloud library loading
KDB-X Python no longer loads cloud libraries (kurl, objstor, qlog, sql) by default when you import the module. These libraries now use an opt-in model to:
- Speed up imports
- Prevent errors and warnings for users who don’t need these features
To load a library, explicitly enable it using the appropriate environment variable or QARGS option (documented below).
Environment variable and QARGS flag updates
Environment variable changes
- Removed:
PYKX_NOQCE - Added:
PYKX_QCE(use this to enableQCEfeatures)
Updated QARGS flags
The following command-line flags have changed from opt-out to opt-in:
| Removed flag | Replacement |
|---|---|
--no-qce |
--qce |
--no-kurl |
-kurl |
--no-objstor |
--objstor |
--no-qlog |
--qlog |
--no-sql |
--sql |
SQL interface changes
KDB-X now embeds its SQL interface, eliminating the need to load it from an external file like s.k_.
You can initialize the SQL interface in any of the following ways:
- Set
QARGS="--qce",QARGS="--sql", orPYKX_QCE=True - From Python, the first call to
kx.q.sqlautomatically loads the library. - From q, call
.s.init[]or make a query starting withs)which will automatically load the SQL library on first use.
Important:
If your code calls.sfunctions directly (for example,.s.e), make sure you load the SQL interface first using one of the methods above.
Threading behavior
KDB-X no longer sets a default value for secondary threads.
To enable them, use either of the following:
- Set
QARGS="-s N" - Add
s=Nto yourQCFGfile
Release Notes
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. - 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.
Next steps
KDB-X Python continues to evolve with the KDB-X platform. For upcoming changes and recent updates, refer to:
Note:
KDB-X Python is in beta (btag) and under active development. Expect regular updates.