Python SDK API
Install the SDK and any data-source extras by following Deploy, Install, and Connect. This reference documents the public Python interfaces supported for Kumo Relational.
Import the supported public interfaces from kumo_relational_client:
RelationalClient
A RelationalClient manages a connection to a single NIM endpoint. Use it as a context manager for a scoped sequence of requests. For an application or notebook that makes multiple requests, create one client, reuse it, and call close() when finished. Calling close() retires the client permanently; construct a new client instead of attempting to reuse a closed one.
The SDK supports one model, kumo-relational. It does not expose a public adapter registry or model-registration extension point.
For managed serving endpoints, use the supported constructors instead of assembling authentication headers manually:
Install the corresponding databricks-serving or snowflake-serving extra first.
Several clients can target different endpoints or tenants concurrently, including from multiple threads. Each prediction remains bound to the endpoint and credential of the client that started it. The underlying relational engine also maintains process-wide configuration, so do not mix direct kumo_relational_engine.init() calls with RelationalClient usage in the same process.
read()
Use the root-level read() function to load one flat table into a pandas DataFrame without creating a RelationalClient:
source can be local, s3, sqlite, duckdb, snowflake, or databricks. Local and S3 reads accept CSV and Parquet data. SQL sources require exactly one of table= or query= plus the connection arguments for that backend. Install the corresponding connector extra, such as kumo-relational-client[s3] or kumo-relational-client[duckdb], before using an optional backend.
client.relational(graph).predict()
client.relational(graph) returns a lightweight handle bound to the graph. Call its predict() method with a PQL query and any prediction settings:
Refer to Configuration for defaults, accepted values, and examples. The client uses the X-API-Key header when api_key is set. It refuses to send the key to a non-local endpoint that uses plaintext HTTP.
By default, predict() returns a pandas DataFrame. When explain is enabled, it returns an Explanation object with prediction, details, and summary attributes.
The model handle caches the most recently materialized graph per thread. In-place edits to a table’s data after its first prediction are not included in later predictions; rebuild the graph to use the new values. Schema changes, including added or removed tables, columns, or links, are detected.
Graph and table interfaces
The relational module imported from kumo_relational_client provides the supported graph interface. Create a graph with relational.Graph.from_data() or a connector-backed Graph.from_*() factory. Then, bind the graph by calling client.relational(graph).
You do not need to construct table objects directly. Access graph["table_name"] only when you need to inspect or correct inferred keys, timestamps, or semantic types.
Run inference through client.relational(graph).predict(...). Standard applications do not construct internal request objects or directly initialize and authenticate the underlying Kumo Relational driver.
Use relational.Graph to construct graphs.
Direct engine initialization and direct inference through an internal model object are not supported. Create RelationalClient, then bind the graph with client.relational(graph).
Errors
Import the three public error families from their owning packages:
Catch RelationalError at the RelationalClient boundary and inspect its code attribute. Supported codes include INVALID_REQUEST, INVALID_CONFIGURATION, TRANSPORT_ERROR, INVALID_RESPONSE, UNSUPPORTED_FEATURE, UNKNOWN_MODEL, MISSING_EXTRA, INTERNAL_ERROR, SERVING_INIT_FAILED, DRIVER_LOAD_FAILED, and AUTHENTICATION_FAILED.
Typed relational connection and graph-construction failures are exported by kumo_relational_engine:
Relational validation failures crossing the RelationalClient boundary use RelationalError(code="INVALID_REQUEST"). This includes caller lookup failures such as a misspelled exclude_cols_dict entry. Malformed transport and create-session responses use INVALID_RESPONSE, while request transport failures use TRANSPORT_ERROR.
The root-level read() function translates connector failures into RelationalError with the codes UNKNOWN_CONNECTOR, INVALID_CONNECTOR_ARGS, CONNECT_FAILED, QUERY_FAILED, READ_FAILED, NOT_FOUND, or DRIVER_LOAD_FAILED. A missing optional driver raises MissingExtraError with MISSING_EXTRA. Calls made directly through kumo_connectors raise ConnectorError instead.
Internal request classes are not part of the supported root-level API. Run inference through client.relational(graph).predict(...) or predict_task(...); do not call direct engine initialization for standard inference.
Importing kumo_relational_engine does not configure the application’s root logger or open a connection. The package attaches logging behavior only to its own logger; create a RelationalClient explicitly when a connection is required.