Update semantic entries

Updates a semantic entry with the complete entry definition.

HTTP
PUT $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/entries/{entry_id}

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 semantic entry list to read the original entry and obtain the entry ID and existing definition to avoid missing existing fields. Prepare a personal access token and target workspace ID that can access the target workspace.

Request body

Replace $MODEL_ID, $ENTRY_ID, $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.

Shell
curl -X PUT "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/entries/$ENTRY_ID" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "metric",
  "key": "total_rows",
  "spec": {
    "name": "GMV",
    "metric_type": "aggregate",
    "aggregation": "SUM",
    "field": "amount",
    "source_table": "orders"
  },
  "tables": [
    "orders"
  ]
}'

Parameter

Type

Required

Description

model_id

integer

Yes

knowledge base ID.

entry_id

integer

Yes

The ID of the semantic entry to update.

Request body

Field

Type

Required

Description

domain

string

No

semantic domain. When creating and updating, omitting this field defaults to nl2sql. Values: empty string, nl2sql, rag.

kind

string

Yes

The entry type determines the structure of spec. Values: metric, table_description, field_description, business_rule, constraint, relationship, standard_qa, dynamic_query.

key

string

Yes

The entry’s reference key. Cannot be empty.

tables

array of string or null

No

Association table name. Resubmit when needed.

spec

object

Yes

Fill in the configuration listed in this section according to kind, and the content must comply with the verification rules of this type.

name

string

Yes

Name.

synonyms

array of string or null

No

Synonyms.

description

string

No

Description.

source_table

string

No

Source table.

metric_type

string

Yes

Indicator type.

aggregation

string

No

Aggregation functions.

field

string

No

field.

filter

object or null

No

Filter tree.

filter.type

string

No

type.

filter.op

string

No

Conditional connection method.

filter.children

array of object or null

No

sub-condition.

filter.field

string

No

field.

filter.operator

string

No

Comparison operators.

filter.value

any

No

Value.

multiplier

number

No

Multiplier.

formula

object or null

No

Formula tree.

formula.type

string

No

type.

formula.key

string

No

Key.

formula.value

number or null

No

Value.

formula.left

object or null

No

left operand.

formula.right

object or null

No

Right operand.

type

string

No

type.

op

string

No

Conditional connection method.

children

array of object or null

No

sub-condition.

operator

string

No

Comparison operators.

value

any

No

Value.

key

string

No

Key.

value

number or null

No

Value.

left

object or null

No

left operand.

right

object or null

No

Right operand.

table

string

No

Table name.

description

string

Yes

Description.

column

string

Yes

Column name.

nl2sql_enabled

boolean or null

No

Whether to enable natural language conversion to SQL.

rule

string

Yes

Business rules.

files

array of string or null

No

File configuration.

migration_status

string

No

Migration status.

filter

object

Yes

Filter tree.

left_table

string

Yes

Table left.

right_table

string

Yes

Right table.

join_type

string

No

Connection type.

conditions

array of object or null

No

Connection conditions.

conditions[].operator

string

No

Comparison operators.

conditions[].left

string

No

left operand.

conditions[].right

string

No

Right operand.

left

string

No

left operand.

right

string

No

Right operand.

question

string

Yes

question.

similar_questions

array of string or null

No

Similar questions.

sql

string

No

SQL text.

answer

string

No

answer.

usage_mode

string

No

Usage.

query_key

string

No

Query key.

sql

string

Yes

SQL text.

handling

string

No

processing method.

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.

Updates will completely replace the original entry. When modifying domain or kind, resubmit key, tables and spec and meet the verification rules of the target domain. The updated set of entries must also pass validation.

children is an array of nodes with the same structure. Fill in recursively according to the field definitions in this section.

left and right are formula nodes with the same structure. Fill in recursively according to the field definitions in this section.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "updated": true
  }
}

Field

Type

Description

data.deleted

boolean

Remove mark or quantity.

data.updated

boolean

true indicates that the update is complete.

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