Skip to content

kxi-toolkit: Types

KDB-X Types for annotating UDA function signatures.

Friendly aliases — import these for concise UDA signatures:

Alias Full name q type
Symbol SymbolAtom -11h
Timestamp TimestampAtom -12h
Date DateAtom -14h
Long LongAtom -7h
Int IntAtom -6h
Float FloatAtom -9h
Real RealAtom -8h
Boolean BooleanAtom -1h
Char CharAtom -10h
String CharVector 10h
Table Table 98h
Dictionary Dictionary 99h
Example
from kxi_toolkit import Symbol, Timestamp, Table

@uda.name("salesSummary")
@uda.safe()
def sales_summary(table: Symbol, startTS: Timestamp = None, endTS: Timestamp = None) -> Table:
    raw = select_table(table, startTS, endTS)
    ...

Attributes:

PY_TYPE_MAP

PY_TYPE_MAP: dict[str, int] = {name: (getattr(kx, name).t) for name in (vars(kx)) if any((tag in name) for tag in ('Atom', 'Vector', 'Dict', 'Table', 'List')) and isinstance(getattr(getattr(kx, name), 't', None), int)}

Mapping of PyKX type class name to q type code integer.

Built from the live PyKX module when available; falls back to a hardcoded map when PyKX is not installed. Useful for tooling that needs to resolve type codes without importing PyKX directly.

Back to top