Export semantic entries

Export knowledge base definitions and semantic entries for review or migration.

HTTP
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.

Shell
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

model_id

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.

  • nl2sql supports the 8 entries listed in the following table.

  • rag only supports business_rule and standard_qa.

  • standard_qa Fill in a single read-only SQL in nl2sql, and fill in answer in rag.

domain in the response is the domain to which the entry actually belongs.

Successful response

JSON
{
  "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

data.model

object

knowledge base definition.

data.model.id

integer

logo.

data.model.name

string

Name.

data.model.description

string

Description.

data.model.tables

array of object

Table reference.

data.model.files

array of object

File configuration.

data.model.source_counts

object

Source quantity statistics.

data.model.source_counts.files

integer

The number of file sources must not be less than 0.

data.model.source_counts.tables

integer

The number of data table sources shall not be less than 0.

data.model.source_counts.total

integer

The sum of the number of file and table sources. Not less than 0.

data.model.created_at

integer

Creation time.

data.model.updated_at

integer

Update time.

data.entries

array of object

Semantic entries in the current knowledge base.

data.entries[].id

integer

logo.

data.entries[].domain

string

The actual semantic domain of the entry. Value: nl2sql, rag.

data.entries[].kind

string

category. Values: metric, table_description, field_description, business_rule, constraint, relationship, standard_qa, dynamic_query.

data.entries[].key

string

Key.

data.entries[].tables

array of string

Table reference.

data.entries[].spec

object

The type corresponds to the configuration.

data.entries[].sql_preview

string

SQL preview.

data.entries[].created_at

integer

Creation time.

data.entries[].updated_at

integer

Update time.

Indicator configuration

Field

Type

Description

name

string

Name.

synonyms

array of string or null

Synonyms.

description

string

Description.

source_table

string

Source table.

metric_type

string

Indicator type.

aggregation

string

Aggregation functions.

field

string

field.

filter

object or null

Filter tree.

filter.type

string

type.

filter.op

string

Conditional connection method.

filter.children

array of object or null

sub-condition.

filter.field

string

field.

filter.operator

string

Comparison operators.

filter.value

any

Value.

multiplier

number

Multiplier.

formula

object or null

Formula tree.

formula.type

string

type.

formula.key

string

Key.

formula.value

number or null

Value.

formula.left

object or null

left operand.

formula.right

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

type

string

type.

op

string

Conditional connection method.

children

array of object or null

sub-condition.

field

string

field.

operator

string

Comparison operators.

value

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

type

string

type.

key

string

Key.

value

number or null

Value.

left

object or null

left operand.

right

object or null

Right operand.

Table description configuration

Field

Type

Description

table

string

Table name.

description

string

Description.

synonyms

array of string or null

Synonyms.

Field description configuration

Field

Type

Description

table

string

Table name.

column

string

Column name.

description

string

Description.

synonyms

array of string or null

Synonyms.

nl2sql_enabled

boolean or null

Whether to enable natural language conversion to SQL.

Business rules configuration

Field

Type

Description

rule

string

Business rules.

files

array of string or null

File configuration.

migration_status

string

Migration status.

constraint configuration

Field

Type

Description

filter

object

Filter tree.

filter.type

string

type.

filter.op

string

Conditional connection method.

filter.children

array of object or null

sub-condition.

filter.field

string

field.

filter.operator

string

Comparison operators.

filter.value

any

Value.

description

string

Description.

Table association configuration

Field

Type

Description

left_table

string

Table left.

right_table

string

Right table.

join_type

string

Connection type.

conditions

array of object or null

Connection conditions.

conditions[].operator

string

Comparison operators.

conditions[].left

string

left operand.

conditions[].right

string

Right operand.

description

string

Description.

Connection conditions

Field

Type

Description

operator

string

Comparison operators.

left

string

left operand.

right

string

Right operand.

Standard Q&A configuration

Field

Type

Description

question

string

question.

similar_questions

array of string or null

Similar questions.

sql

string

SQL text.

answer

string

answer.

usage_mode

string

Usage.

files

array of string or null

File configuration.

description

string

Description.

synonyms

array of string or null

Synonyms.

Dynamic query configuration

Field

Type

Description

query_key

string

Query key.

sql

string

SQL text.

description

string

Description.

handling

string

processing method.

Error response

JSON
{
  "code": "ErrNotFound",
  "msg": "resource not found",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

data

null

null on error.

Last updated on