Export semantic entries¶
Export knowledge base definitions and semantic entries for review or migration.
GET $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/export
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the knowledge base list to obtain the knowledge base ID. Prepare a personal access token and target workspace ID that can access the target workspace.
Request body¶
Replace $MODEL_ID, $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.
curl "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/export" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
The knowledge base ID of the definition to be exported. |
Request body
domain supports nl2sql and rag. When creating and updating, omit domain and default to nl2sql. You can filter by domain when querying the list.
nl2sqlsupports the 8 entries listed in the following table.ragonly supportsbusiness_ruleandstandard_qa.standard_qaFill in a single read-only SQL innl2sql, and fill inanswerinrag.
domain in the response is the domain to which the entry actually belongs.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"model": {
"id": 401,
"name": "product_docs",
"tables": null,
"source_counts": {
"files": 2,
"tables": 1,
"total": 3
},
"created_at": 0,
"updated_at": 0
},
"entries": [
{
"id": 501,
"domain": "nl2sql",
"kind": "metric",
"key": "total_rows",
"tables": [
"orders"
],
"spec": {
"name": "GMV",
"metric_type": "aggregate",
"aggregation": "SUM",
"field": "amount"
},
"created_at": 0,
"updated_at": 0
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
object |
knowledge base definition. |
|
integer |
logo. |
|
string |
Name. |
|
string |
Description. |
|
array of object |
Table reference. |
|
array of object |
File configuration. |
|
object |
Source quantity statistics. |
|
integer |
The number of file sources must not be less than 0. |
|
integer |
The number of data table sources shall not be less than 0. |
|
integer |
The sum of the number of file and table sources. Not less than 0. |
|
integer |
Creation time. |
|
integer |
Update time. |
|
array of object |
Semantic entries in the current knowledge base. |
|
integer |
logo. |
|
string |
The actual semantic domain of the entry. Value: |
|
string |
category. Values: |
|
string |
Key. |
|
array of string |
Table reference. |
|
object |
The type corresponds to the configuration. |
|
string |
SQL preview. |
|
integer |
Creation time. |
|
integer |
Update time. |
Indicator configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Name. |
|
array of string or null |
Synonyms. |
|
string |
Description. |
|
string |
Source table. |
|
string |
Indicator type. |
|
string |
Aggregation functions. |
|
string |
field. |
|
object or null |
Filter tree. |
|
string |
type. |
|
string |
Conditional connection method. |
|
array of object or null |
sub-condition. |
|
string |
field. |
|
string |
Comparison operators. |
|
any |
Value. |
|
number |
Multiplier. |
|
object or null |
Formula tree. |
|
string |
type. |
|
string |
Key. |
|
number or null |
Value. |
|
object or null |
left operand. |
|
object or null |
Right operand. |
filter tree
children is an array of nodes with the same structure. Fill in recursively according to the field definitions in this section.
Field |
Type |
Description |
|---|---|---|
|
string |
type. |
|
string |
Conditional connection method. |
|
array of object or null |
sub-condition. |
|
string |
field. |
|
string |
Comparison operators. |
|
any |
Value. |
formula tree
left and right are formula nodes with the same structure. Fill in recursively according to the field definitions in this section.
Field |
Type |
Description |
|---|---|---|
|
string |
type. |
|
string |
Key. |
|
number or null |
Value. |
|
object or null |
left operand. |
|
object or null |
Right operand. |
Table description configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Table name. |
|
string |
Description. |
|
array of string or null |
Synonyms. |
Field description configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Table name. |
|
string |
Column name. |
|
string |
Description. |
|
array of string or null |
Synonyms. |
|
boolean or null |
Whether to enable natural language conversion to SQL. |
Business rules configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Business rules. |
|
array of string or null |
File configuration. |
|
string |
Migration status. |
constraint configuration
Field |
Type |
Description |
|---|---|---|
|
object |
Filter tree. |
|
string |
type. |
|
string |
Conditional connection method. |
|
array of object or null |
sub-condition. |
|
string |
field. |
|
string |
Comparison operators. |
|
any |
Value. |
|
string |
Description. |
Table association configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Table left. |
|
string |
Right table. |
|
string |
Connection type. |
|
array of object or null |
Connection conditions. |
|
string |
Comparison operators. |
|
string |
left operand. |
|
string |
Right operand. |
|
string |
Description. |
Connection conditions
Field |
Type |
Description |
|---|---|---|
|
string |
Comparison operators. |
|
string |
left operand. |
|
string |
Right operand. |
Standard Q&A configuration
Field |
Type |
Description |
|---|---|---|
|
string |
question. |
|
array of string or null |
Similar questions. |
|
string |
SQL text. |
|
string |
answer. |
|
string |
Usage. |
|
array of string or null |
File configuration. |
|
string |
Description. |
|
array of string or null |
Synonyms. |
Dynamic query configuration
Field |
Type |
Description |
|---|---|---|
|
string |
Query key. |
|
string |
SQL text. |
|
string |
Description. |
|
string |
processing method. |
Error response¶
{
"code": "ErrNotFound",
"msg": "resource not found",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Error description. |
|
null |
|