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 |
|---|---|---|
|
|
Use all available sources or select through |
|
|
Table scope |
|
|
File scope |
Table configuration:
JSON field |
Values or meaning |
|---|---|
|
|
|
Required database name |
|
Numeric ID used when selecting all tables in a database |
|
Table-name array used with |
File configuration:
JSON field |
Values or meaning |
|---|---|
|
|
|
Numeric ID used when selecting all files in a database |
|
File-ID array used with |
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:
Use a table-only request to verify database names, table names, and SQL results.
Use a file-only request to verify retrieval.
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:
DataScopesupportsallandspecifiedand can carry organization code groups.Source comments list
allandnon_inter_dataforFilterConditions.Type.ContextConfiglimits the number of knowledge entries and the value length made available to analysis.
Preflight checklist¶
A
specifiedtable scope has a non-emptydb_nameand real table names.A
specifiedfile scope contains only Catalog file IDs.Unused optional branches are omitted; if a branch must be explicit, use
nonewhile still satisfying its required fields.The caller has read or query permission on every object.
The application records the source configuration and the
request_idfrom the init event.
Continue with Explore queries and streaming answers to consume the stream.