Knowledge and Explore

The official MOI Python SDK and Go SDK expose NL2SQL knowledge entries, SQL execution, and streamed Explore/Data Asking analysis. Python passes dictionaries to RawClient; Go uses RawClient with public request types. Their method sets closely correspond.

In the current public SDKs, “knowledge” means an NL2SQL knowledge entry, not a complete Knowledge Base object from the product UI. The SDKs do not currently expose dedicated methods to create a knowledge base, bind its sources, edit file chunks, or switch chunk versions. Use the flows in the Knowledge Bases guide for those operations. This section documents only capabilities verified in the two SDK repositories.

Choose a path

Goal

Start here

Save business terms, rules, or examples for NL2SQL

Semantic models

Understand the boundary between Catalog sources and NL2SQL entries

Knowledge sources and entries

Prepare the data scope for an Explore run

Explore data sources

Consume retrieval, SQL, and answer events

Explore queries and streaming answers

Clients and capabilities

Capability

Python

Go

Create a client

RawClient(base_url, api_key)

NewRawClient(baseURL, apiKey)

NL2SQL knowledge entries

Six methods including create_knowledge

Six methods including CreateKnowledge

Execute an SQL operation

run_nl2sql

RunNL2SQL

Stream data analysis

analyze_data_stream

AnalyzeDataStream

Cancel analysis

cancel_analyze

CancelAnalyze

On success, Python RawClient returns the data portion of the service envelope; Go returns a typed response. Handle business and HTTP failures separately. See SDK fundamentals for installation, authentication, and common error conventions.

Shared constraints

  • Table and file IDs come from Catalog, and the caller still needs permission on those underlying objects.

  • delete_knowledge permanently deletes one NL2SQL knowledge entry; it does not delete a Catalog table or file.

  • The public run_nl2sql request executes an operation. It is not a separate high-level “send natural language and generate SQL” helper.

  • Explore event types and payloads can grow with the service. Consumers should ignore unknown events and preserve raw events for diagnosis.

A useful integration boundary

Keep knowledge-entry management and online queries in separate application modules:

  • The management module owns Catalog objects and NL2SQL knowledge entries.

  • The query module accepts only validated data scopes and owns sessions, streaming events, cancellation, citations, and failures.

This prevents an online request from changing knowledge configuration and makes entry changes easier to review and regression-test.