Skip to content

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:

  • QCFG configuration option has been added.
    • Defaults to ~/.kx/config if this file exists.
  • The current working directory is no longer checked for a license.
    • Only QLIC and QHOME will be checked.
  • .z.v has been added to the ZContext which holds initialisation values for version, QCFG, QHOME, QLIC, and QINIT.

KDB-X Python configuration changes

  • The default configuration file is config-pykx, no longer .pykx-config.
  • PYKX_CONFIGURATION_LOCATION now 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_LOCATION if it is set, then ~/.kx/config-pykx if it exists.
  • . and ~ are no longer searched for a config file.
  • kx.util.add_to_config changes:
    • An optional profile argument to specify which profile configuration values should saved to has been added.
      • This defaults to kx.config.pykx_config_profile to pick up any prevailing value set by the user.
      • If no value is chosen the default is default
    • The optional folder argument has been replaced with file:
      • This defaults to kx.config.pykx_config_location to pick up a prevailing valid file if in use.
      • If pykx_config_location is empty a new file ~/.kx/config-pykx will be created.
    • Added arguments are no longer added to os.environ, they are only added to the configuration file.
  • kx.util.install_q changes:
    • An optional config_file argument has been added. Defaults to pykx_config_location.
    • An optional config_profile argument has been added. Defaults to pykx_config_profile.
  • PYKX_4_1_ENABLED configuration option has been removed.
  • The NEP-49 allocator now defaults to on to support zero copy conversions when possible.
    • PYKX_ALLOCATOR configuration option has been removed. PYKX_NO_ALLOCATOR has been added if you wish to opt out of this behaviour.
    • --pykxalloc entry for QARGS/q command line has been removed. --pykxnoalloc has 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_NOQCE environment variable has been removed and replaced with PYKX_QCE.

  • QARGS command line options have also changed:

    • --no-qce has been removed and replaced with --qce.
    • --no-kurl has been removed and replaced with --kurl.
    • --no-objstor has been removed and replaced with --objstor.
    • --no-qlog has been removed and replaced with --qlog.
    • --no-sql has 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=True as detailed above.
    • From Python, the first call to kx.q.sql automatically loads the interface.
    • From q, call .s.init[] or make a query starting with s) which will automatically load the SQL interface on first use.
  • If a user has code directly calling a .s function 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 entry s=N to your QCFG.

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 VirtualTable class 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

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)