Send Feedback
Skip to content

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 b tag 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 QCFG configuration option. If the file ~/.kx/config exists, 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 QLIC and QHOME.
  • Added .z.v to the ZContext which holds initialization values for: version, QCFG, QHOME, QLIC, and QINIT.

KDB-X Python configuration changes

Configuration file location

  • Replaced the default config file .pykx-config with config-pykx.
  • PYKX_CONFIGURATION_LOCATION now 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 profile argument to specify the profile that should receive configuration values.
  • Defaults to kx.config.pykx_config_profile.
  • Uses default if 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_file argument (defaults to pykx_config_location).
  • Added a config_profile argument (defaults to pykx_config_profile).

Removed or replaced options

  • Removed PYKX_4_1_ENABLED configuration option.
  • Enabled the NEP-49 allocator by default to support zero-copy conversions.
  • Removed PYKX_ALLOCATOR
  • Added PYKX_NO_ALLOCATOR to allow users to opt out
  • Removed --pykxalloc (QARGS/q command-line option)
  • Added --pykxnoalloc as 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 enable QCE features)

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", or PYKX_QCE=True
  • From Python, the first call to kx.q.sql automatically loads the library.
  • From q, call .s.init[] or make a query starting with s) which will automatically load the SQL library on first use.

Important:
If your code calls .s functions 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=N to your QCFG file

Release Notes

KDB-X Python 4.0.0b4

Release Date: 2025-11-17

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 sequence warnings upon import for some users.
  • Turns on NumPy allocator by default.
  • Replaces PYKX_ALLOCATOR with PYKX_NO_ALLOCATOR.
  • Replaces --pykxalloc with --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 (b tag) and under active development. Expect regular updates.