Explore Data Sources

AnalyzeDataStream and analyze_data_stream restrict each analysis through config.data_source. This is a per-request scope; it does not create a persistent Knowledge Base.

Data-source shape

The Go SDK exposes DataSource:

Field

Values

Purpose

Type / type

all or specified

Use all available sources or select through tables and files

Tables / tables

DataAskingTableConfig

Table scope

Files / files

FileConfig

File scope

Table configuration:

JSON field

Values or meaning

type

all, none, or specified

db_name

Required database name

database_id

Numeric ID used when selecting all tables in a database

table_list

Table-name array used with specified

File configuration:

JSON field

Values or meaning

type

all, none, or specified

database_id

Numeric ID used when selecting all files in a database

file_id_list

File-ID array used with specified

The effective meaning of all is still constrained by caller permissions and service policy. Production applications should prefer specified so that the allowed sources for a run are explicit and auditable.

Query specific tables only

Python:

request = {
    "question": "Show the monthly order totals.",
    "config": {
        "data_source": {
            "type": "specified",
            "tables": {
                "type": "specified",
                "db_name": "sales",
                "table_list": ["orders"],
            },
            "files": {"type": "none"},
        }
    },
}

stream = raw.analyze_data_stream(request)

Go:

req := &sdk.DataAnalysisRequest{
    Question: "Show the monthly order totals.",
    Config: &sdk.DataAnalysisConfig{
        DataSource: &sdk.DataSource{
            Type: "specified",
            Tables: &sdk.DataAskingTableConfig{
                Type:      "specified",
                DbName:    "sales",
                TableList: []string{"orders"},
            },
            Files: &sdk.FileConfig{Type: "none"},
        },
    },
}

stream, err := client.AnalyzeDataStream(ctx, req)

Retrieve from specific files only

Python:

request = {
    "question": "Summarize the renewal conditions.",
    "config": {
        "data_source": {
            "type": "specified",
            "files": {
                "type": "specified",
                "file_id_list": selected_file_ids,
            },
        }
    },
}

Resolve file IDs through the Catalog file API. Do not pass file names, paths, or knowledge-entry IDs.

Combine tables and files

One DataSource can specify both tables and files. Stream events distinguish RAG and NL2SQL processing through source. Validate the two branches separately before combining them:

  1. Use a table-only request to verify database names, table names, and SQL results.

  2. Use a file-only request to verify retrieval.

  3. Combine the scopes and inspect both kinds of evidence in the final answer.

This makes it much easier to identify whether a mixed-run failure comes from selection, permissions, retrieval, or SQL.

Other scope fields

DataAnalysisConfig also exposes data_scope, filter_conditions, and context_config. They govern organizational scope, filtering, and knowledge-entry limits; they are not substitutes for data_source. Use them only after confirming their semantics with the deployment owner:

  • DataScope supports all and specified and can carry organization code groups.

  • Source comments list all and non_inter_data for FilterConditions.Type.

  • ContextConfig limits the number of knowledge entries and the value length made available to analysis.

Preflight checklist

  • A specified table scope has a non-empty db_name and real table names.

  • A specified file scope contains only Catalog file IDs.

  • Unused optional branches are omitted; if a branch must be explicit, use none while still satisfying its required fields.

  • The caller has read or query permission on every object.

  • The application records the source configuration and the request_id from the init event.

Continue with Explore queries and streaming answers to consume the stream.