SDK Fundamentals¶
MOI provides Python and Go SDKs for application access to the Catalog Service. Both SDKs have two layers:
RawClientmaps methods closely to service APIs and is the right choice when code needs precise control of requests and responses.SDKClientwraps aRawClientand combines multiple calls into business-oriented helpers for tasks such as role management, file import, and workflow waiting.
The SDKs currently cover Catalog, Database, Table, Volume, File, Folder, Connector, user, role, privilege, GenAI, workflow, NL2SQL, data analysis, health, and log capabilities. Availability still depends on the connected MOI environment and the caller’s permissions.
Where to begin¶
Goal |
Read |
|---|---|
Install the Python or Go package and pin a reproducible version |
|
Configure the service endpoint, API Key, and request tracing |
|
Choose |
|
Read results, paginate, download files, or consume SSE |
A minimal Python setup looks like this:
import os
from moi import RawClient, SDKClient
raw = RawClient(
base_url=os.environ["MOI_BASE_URL"],
api_key=os.environ["MOI_API_KEY"],
)
sdk = SDKClient(raw)
Go uses the same layering:
raw, err := sdk.NewRawClient(
os.Getenv("MOI_BASE_URL"),
os.Getenv("MOI_API_KEY"),
)
if err != nil {
log.Fatal(err)
}
client := sdk.NewSDKClient(raw)
Start with HealthCheck / health_check on RawClient, then move to the relevant resource section. Do not mix this SDK’s Catalog Service endpoint and moi-key credential with the Genesis model API Base URL and Bearer Key. They are separate integration surfaces.
Working rules¶
Obtain the Base URL and API Key from the target environment’s administration entry point or deployment administrator; never derive them from an example.
Reuse clients within a process. Use request contexts, timeouts, and request IDs to control individual calls.
Use public types and methods instead of manually constructing endpoints that the SDK does not expose.
Follow the request and response types of each list method; not every resource uses the same pagination fields.
Close download and SSE streams promptly, and distinguish a transport end from business completion.
For the current public implementation and method inventory, see the MOI Python SDK and MOI Go SDK.