Workload client for KDB-X Group services.¶
Use WorkloadClient to send GET and POST requests to a specific group and instance on the KDB-X Group service endpoint.
Binary Q/IPC responses are automatically deserialized via pykx when available.
Example
from kxi.workloads import WorkloadClient
client = WorkloadClient(
host="https://<host>",
group="my-group",
instance="my-instance",
client_id="<client-id>",
client_secret="<client-secret>",
)
# GET request to a workload endpoint
result = client.get("status")
# POST request with a payload
result = client.post("query", json={"func": "getTable", "args": []})
Classes:
- WorkloadClient – REST client for a specific kdb Insights KDBX Group workload instance.
WorkloadClient¶
WorkloadClient(host=None, *, group, instance, **kwargs)
Bases: ApiClient
REST client for a specific kdb Insights KDBX Group workload instance.
Routes all requests through /kdbxgroup/<group>/<instance>/ and
automatically deserializes binary Q/IPC responses using pykx when available.
Example
from kxi.workloads import WorkloadClient
client = WorkloadClient(
host="https://<host>",
group="analytics",
instance="primary",
client_id="<client-id>",
client_secret="<client-secret>",
)
result = client.get("status")
data = client.post("run", json={"func": "getTable", "args": []})
See Connection Parameters for shared constructor arguments.
Functions:
- get – Send a GET request to the workload endpoint.
- post – Send a POST request to the workload endpoint.
Initialise WorkloadClient for a specific group and instance.
Parameters:
- host (
str | URL | None) – Base URL of the kdb Insights Enterprise instance. - group (
str) – KDBX Group name to target. - instance (
str) – Instance name within the group to target. - kwargs – Additional keyword arguments forwarded to the ApiClient constructor
get¶
get(url, **kwargs)
Send a GET request to the workload endpoint.
The request is routed to /<group>/<instance>/<url>.
Parameters:
- url (
str) – Relative path within the workload instance. - *kwargs* – Additional keyword arguments forwarded to the HTTP client.
Returns:
dict– Parsed response payload. Binary Q/IPC responses are deserializeddict– via pykx when available.
post¶
post(url, **kwargs)
Send a POST request to the workload endpoint.
The request is routed to /<group>/<instance>/<url>.
Parameters:
- url (
str) – Relative path within the workload instance. - *kwargs* – Additional keyword arguments forwarded to the HTTP client
(e.g.
json=,content=).
Returns: