Updated on 2026-02-05 GMT+08:00

Creating a Table

Function

This API is used to create a table.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/workspaces/{workspace_id}/siem/tables

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID

Constraints

N/A

Range

N/A

Default Value

N/A

workspace_id

Yes

String

Workspace ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

table_name

Yes

String

Table name.

table_alias

Yes

String

Table alias.

table_alias_en

No

String

Table alias.

table_alias_fr

No

String

Table alias.

category

Yes

String

Definition

Directory type.

  • STREAMING real-time stream

  • INDEX: index

  • APPLICATION: application

  • TENANT_BUCKET: tenant bucket

  • LAKE: data lake

Constraints

N/A

Range

  • STREAMING

  • INDEX

  • APPLICATION

  • TENANT_BUCKET

  • LAKE

Default Value

N/A

format

Yes

String

Definition

Table format.

  • JSON: JSON

  • CSV: CSV

  • PARQUET: PARQUET

  • ORC ORC

-DEBEZIUM_JSON: Debezium JSON

Constraints

N/A

Range

  • JSON

  • DEBEZIUM_JSON

  • CSV

  • PARQUET

  • ORC

Default Value

N/A

description

No

String

Table description.

description_en

No

String

Table description.

description_fr

No

String

Table description.

directory

No

String

Directory group.

directory_en

No

String

Directory group.

directory_fr

No

String

Directory group.

data_classification

No

String

Definition

Data classification.

  • FACTUAL_DATA: factual data

  • DIMENSION_DATA: dimension data

Constraints

N/A

Range

  • FACTUAL_DATA

  • DIMENSION_DATA

Default Value

N/A

schema

Yes

IsapTableSchema object

Table structure.

storage_setting

Yes

TableStorageSetting object

Table storage settings.

display_setting

Yes

TableDisplaySetting object

Table display settings.

create_policy

No

String

Definition

Creation policy.

  • SYS_INIT_INDEX_APP_TBL: system initialization index application table

  • DEFAULT: default

Constraints

N/A

Range

  • SYS_INIT_INDEX_APP_TBL

  • DEFAULT

Default Value

N/A

Table 4 IsapTableSchema

Parameter

Mandatory

Type

Description

columns

No

Array of IsapTableColumn objects

Table column list.

primary_key

No

Array of strings

Table primary key list.

partition

No

Array of strings

Table partition list.

watermark_column

No

String

Table watermark column element.

watermark_interval

No

Float

Table watermark delay interval.

time_filter

No

String

Table time filter column.

Table 5 IsapTableColumn

Parameter

Mandatory

Type

Description

column_name

No

String

Table column name.

column_type

No

String

Definition

Column field type.

  • PHYSICAL: physical field

  • METADATA: metadata field

  • VIRTUAL_METADATA: virtual metadata field

  • COMPUTED: computation field

Constraints

N/A

Range

  • PHYSICAL

  • METADATA

  • VIRTUAL_METADATA

  • COMPUTED

Default Value

N/A

column_type_setting

No

String

Table column type settings.

column_data_type

No

String

Definition

Column data type.

  • ROW: row type

  • MAP_STRING: string mapping type

  • MAP_DECIMAL: decimal mapping type

  • TINYINT: tiny integer

  • SMALLINT: small integer

  • INT: integer

  • BIGINT: long integer

  • DECIMAL: decimal data type

  • FLOAT: single-precision floating point

  • DOUBLE: double-precision floating point

  • CHAR: fixed-length string

  • VARCHAR: variable-length string

  • STRING: string type

  • KEYWORD: keyword type

  • BOOLEAN: boolean type

  • DATE: date type

  • TIME: time type

  • TIMESTAMP: timestamp type

  • TIMESTAMP_LTZ: local timestamp type

Constraints

N/A

Range

  • ROW

  • MAP_STRING

  • MAP_DECIMAL

  • TINYINT

  • SMALLINT

  • INT

  • BIGINT

  • DECIMAL

  • FLOAT

  • DOUBLE

  • CHAR

  • VARCHAR

  • STRING

  • KEYWORD

  • BOOLEAN

  • DATE

  • TIME

  • TIMESTAMP

  • TIMESTAMP_LTZ

Default Value

N/A

column_data_type_setting

No

String

Table column data type setting

nullable

No

Boolean

Empty or not.

array

No

Boolean

Array or not.

depth

No

Integer

Depth.

parent_name

No

String

Parent-level name.

own_name

No

String

Name.

column_display_setting

No

ColumnDisplaySetting object

Table column display settings.

column_sequence_number

No

Integer

Column No.

Table 6 ColumnDisplaySetting

Parameter

Mandatory

Type

Description

mapping_required

No

Boolean

Whether the mapping is mandatory.

group_sequence_number

No

Integer

Group sequence number.

intra_group_sequence_number

No

Integer

Group sequence number.

value_type

No

String

Value type.

value_qualified

No

String

Valid value.

display_name

No

String

Display name.

display_description

No

String

Display description.

group_name

No

String

Group name.

Table 7 TableStorageSetting

Parameter

Mandatory

Type

Description

application_index

No

String

Application index.

application_topic

No

String

Application theme.

application_data_class_id

No

String

Application data class ID.

streaming_bandwidth

No

Number

Streaming bandwidth (MB/s).

streaming_partition

No

Integer

Streaming partition.

streaming_retention_size

No

Integer

Streaming capacity.

streaming_dataspace_id

No

String

Streaming data space ID.

index_storage_period

No

Integer

Index storage period.

index_storage_size

No

Integer

Index storage size.

index_shards

No

Integer

Number of index shards.

index_replicas

No

Integer

Number of index replicas.

lake_storage_period

No

Long

Data lake storage period.

lake_partition_setting

No

String

Definition

Time unit.

  • MINUTE10: 10 minutes

  • HOUR

  • DAY

Constraints

N/A

Range

  • MINUTE

  • HOUR

  • DAY

Default Value

N/A

lake_expiration_status

No

String

Definition

Data lake expiration status.

  • NOT_EXPIRED: not expired

  • EXPIRED_PROCESSING: expired and being processed

  • EXPIRED_SUCCESS: expired and processed successfully

  • EXPIRED_FAILURE: expired but failed to be processed

Constraints

N/A

Range

  • NOT_EXPIRED

  • EXPIRED_PROCESSING

  • EXPIRED_SUCCESS

  • EXPIRED_FAILURE

Default Value

N/A

Table 8 TableDisplaySetting

Parameter

Mandatory

Type

Description

columns

No

Array of TableColumnDisplaySetting objects

Table column display list.

format

No

String

Definition

Table display settings.

  • Table: A table will be displayed.

  • RAW: Raw data will be displayed.

Constraints

N/A

Range

  • TABLE

  • RAW

Default Value

N/A

Table 9 TableColumnDisplaySetting

Parameter

Mandatory

Type

Description

column_name

No

String

Table column name.

column_alias

No

String

Table column alias.

display_by_default

No

Boolean

Whether to use default display settings.

Response Parameters

Status code: 200

Table 10 Response body parameters

Parameter

Type

Description

project_id

String

Project ID.

workspace_id

String

Workspace ID.

table_id

String

UUID

pipe_id

String

UUID

table_name

String

Table name.

table_alias

String

Table alias.

description

String

Description.

directory

String

Directory group.

category

String

Definition

Directory type.

  • STREAMING real-time stream

  • INDEX: index

  • APPLICATION: application

  • TENANT_BUCKET: tenant bucket

  • LAKE: data lake

Constraints

N/A

Range

  • STREAMING

  • INDEX

  • APPLICATION

  • TENANT_BUCKET

  • LAKE

Default Value

N/A

lock_status

String

Definition

Table lock status.

  • LOCKED: locked

  • UNLOCKED: unlocked

Constraints

N/A

Range

  • LOCKED

  • UNLOCKED

Default Value

N/A

process_status

String

Definition

Handling status.

  • COMPLETED: completed.

  • CREATING: being created

  • UPDATING: being updated

  • DELETING: being deleted

  • TRUNCATING being cleared

  • UPGRADING: being upgraded

  • CREATE_FAILED: creation failed

  • UPDATE_FAILED: update failed

  • DELETE_FAILED: deletion failed

  • TRUNCATE_FAILED: clearing failed

  • UPGRADE_FAILED: upgrade failed

Constraints

N/A

Range

  • COMPLETED

  • CREATING

  • UPDATING

  • DELETING

  • TRUNCATING

  • UPGRADING

  • CREATE_FAILED

  • UPDATE_FAILED

  • DELETE_FAILED

  • TRUNCATE_FAILED

  • UPGRADE_FAILED

Default Value

N/A

process_error

String

Definition

Table processing error.

  • NONE

  • MISSING_ASSOCIATIONS: Association missing

  • FAILED_INIT_STORAGE_RESOURCES_WHEN_CREATING: failed to initialize storage resources during creation

  • FAILED_INIT_FLINK_RESOURCES_WHEN_CREATING: failed to initialize Flink resources during creation

  • FAILED_DELETE_FLINK_RESOURCES_WHEN_DELETING: failed to delete Flink resources during deletion

  • FAILED_DELETE_STORAGE_RESOURCES_WHEN_DELETING: failed to delete storage resources during deletion

  • FAILED_DELETE_ALL_RESOURCES_WHEN_DELETING: failed to delete all resources during deletion

  • FAILED_UPDATE_STORAGE_SETTING: failed to update the storage configuration

  • FAILED_UPDATE_FLINK_SCHEMA: failed to update the Flink schema

  • FAILED_UPDATE_STORAGE_SCHEMA: failed to update the storage schema

  • FAILED_TO_APPLY_RESOURCE: failed to apply the resource

  • FAILED_TO_UPGRADE_RESOURCE_MODEL: failed to upgrade the resource model

Constraints

N/A

Range

  • NONE

  • MISSING_ASSOCIATIONS

  • FAILED_INIT_STORAGE_RESOURCES_WHEN_CREATING

  • FAILED_INIT_FLINK_RESOURCES_WHEN_CREATING

  • FAILED_DELETE_FLINK_RESOURCES_WHEN_DELETING

  • FAILED_DELETE_STORAGE_RESOURCES_WHEN_DELETING

  • FAILED_DELETE_ALL_RESOURCES_WHEN_DELETING

  • FAILED_UPDATE_STORAGE_SETTING

  • FAILED_UPDATE_FLINK_SCHEMA

  • FAILED_UPDATE_STORAGE_SCHEMA

  • FAILED_TO_APPLY_RESOURCE

  • FAILED_TO_UPGRADE_RESOURCE_MODEL

Default Value

N/A

format

String

Definition

Table format.

  • JSON: JSON

  • CSV: CSV

  • PARQUET: PARQUET

  • ORC ORC

-DEBEZIUM_JSON: Debezium JSON

Constraints

N/A

Range

  • JSON

  • DEBEZIUM_JSON

  • CSV

  • PARQUET

  • ORC

Default Value

N/A

rw_type

String

Definition

Table read/write type.

  • READ_ONLY: read-only

  • READ_WRITE: read and write

  • WRITE_ONLY: write-only

Constraints

N/A

Range

  • READ_ONLY

  • READ_WRITE

  • WRITE_ONLY

Default Value

N/A

owner_type

String

Definition

Owner type.

  • SYSTEM: system

  • USER: user

  • SYSTEM_ALLOWED_DELETE: can be deleted by the system

  • USER_ALLOWED_DELETE: can be deleted by the user

Constraints

N/A

Range

  • SYSTEM

  • USER

  • SYSTEM_ALLOWED_DELETE

  • USER_ALLOWED_DELETE

Default Value

N/A

data_layering

String

Definition

Data layers.

  • ODS: operation data storage layer

  • DWS: data warehouse service layer

  • ADS: application data service layer

Constraints

N/A

Range

  • ODS

  • DWS

  • ADS

Default Value

N/A

data_classification

String

Definition

Data classification.

  • FACTUAL_DATA: factual data

  • DIMENSION_DATA: dimension data

Constraints

N/A

Range

  • FACTUAL_DATA

  • DIMENSION_DATA

Default Value

N/A

schema

IsapTableSchema object

Table structure.

storage_setting

TableStorageSetting object

Table storage settings.

display_setting

TableDisplaySetting object

Table display settings.

create_time

Integer

Timestamp, in ms.

update_time

Integer

Timestamp, in ms.

delete_time

Integer

Timestamp, in ms.

Table 11 IsapTableSchema

Parameter

Type

Description

columns

Array of IsapTableColumn objects

Table column list.

primary_key

Array of strings

Table primary key list.

partition

Array of strings

Table partition list.

watermark_column

String

Table watermark column element.

watermark_interval

Float

Table watermark delay interval.

time_filter

String

Table time filter column.

Table 12 IsapTableColumn

Parameter

Type

Description

column_name

String

Table column name.

column_type

String

Definition

Column field type.

  • PHYSICAL: physical field

  • METADATA: metadata field

  • VIRTUAL_METADATA: virtual metadata field

  • COMPUTED: computation field

Constraints

N/A

Range

  • PHYSICAL

  • METADATA

  • VIRTUAL_METADATA

  • COMPUTED

Default Value

N/A

column_type_setting

String

Table column type settings.

column_data_type

String

Definition

Column data type.

  • ROW: row type

  • MAP_STRING: string mapping type

  • MAP_DECIMAL: decimal mapping type

  • TINYINT: tiny integer

  • SMALLINT: small integer

  • INT: integer

  • BIGINT: long integer

  • DECIMAL: decimal data type

  • FLOAT: single-precision floating point

  • DOUBLE: double-precision floating point

  • CHAR: fixed-length string

  • VARCHAR: variable-length string

  • STRING: string type

  • KEYWORD: keyword type

  • BOOLEAN: boolean type

  • DATE: date type

  • TIME: time type

  • TIMESTAMP: timestamp type

  • TIMESTAMP_LTZ: local timestamp type

Constraints

N/A

Range

  • ROW

  • MAP_STRING

  • MAP_DECIMAL

  • TINYINT

  • SMALLINT

  • INT

  • BIGINT

  • DECIMAL

  • FLOAT

  • DOUBLE

  • CHAR

  • VARCHAR

  • STRING

  • KEYWORD

  • BOOLEAN

  • DATE

  • TIME

  • TIMESTAMP

  • TIMESTAMP_LTZ

Default Value

N/A

column_data_type_setting

String

Table column data type setting

nullable

Boolean

Empty or not.

array

Boolean

Array or not.

depth

Integer

Depth.

parent_name

String

Parent-level name.

own_name

String

Name.

column_display_setting

ColumnDisplaySetting object

Table column display settings.

column_sequence_number

Integer

Column No.

Table 13 ColumnDisplaySetting

Parameter

Type

Description

mapping_required

Boolean

Whether the mapping is mandatory.

group_sequence_number

Integer

Group sequence number.

intra_group_sequence_number

Integer

Group sequence number.

value_type

String

Value type.

value_qualified

String

Valid value.

display_name

String

Display name.

display_description

String

Display description.

group_name

String

Group name.

Table 14 TableStorageSetting

Parameter

Type

Description

application_index

String

Application index.

application_topic

String

Application theme.

application_data_class_id

String

Application data class ID.

streaming_bandwidth

Number

Streaming bandwidth (MB/s).

streaming_partition

Integer

Streaming partition.

streaming_retention_size

Integer

Streaming capacity.

streaming_dataspace_id

String

Streaming data space ID.

index_storage_period

Integer

Index storage period.

index_storage_size

Integer

Index storage size.

index_shards

Integer

Number of index shards.

index_replicas

Integer

Number of index replicas.

lake_storage_period

Long

Data lake storage period.

lake_partition_setting

String

Definition

Time unit.

  • MINUTE10: 10 minutes

  • HOUR

  • DAY

Constraints

N/A

Range

  • MINUTE

  • HOUR

  • DAY

Default Value

N/A

lake_expiration_status

String

Definition

Data lake expiration status.

  • NOT_EXPIRED: not expired

  • EXPIRED_PROCESSING: expired and being processed

  • EXPIRED_SUCCESS: expired and processed successfully

  • EXPIRED_FAILURE: expired but failed to be processed

Constraints

N/A

Range

  • NOT_EXPIRED

  • EXPIRED_PROCESSING

  • EXPIRED_SUCCESS

  • EXPIRED_FAILURE

Default Value

N/A

Table 15 TableDisplaySetting

Parameter

Type

Description

columns

Array of TableColumnDisplaySetting objects

Table column display list.

format

String

Definition

Table display settings.

  • Table: A table will be displayed.

  • RAW: Raw data will be displayed.

Constraints

N/A

Range

  • TABLE

  • RAW

Default Value

N/A

Table 16 TableColumnDisplaySetting

Parameter

Type

Description

column_name

String

Table column name.

column_alias

String

Table column alias.

display_by_default

Boolean

Whether to use default display settings.

Status code: 400

Table 17 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

Create a table.

https://{endpoint}/v2/{project_id}/workspaces/{workspace_id}/siem/tables

{
  "table_name" : "i_test_table",
  "table_alias" : "test_alias_2",
  "directory" : "",
  "directory_en" : "",
  "directory_fr" : "",
  "description" : "",
  "category" : "INDEX",
  "format" : "JSON",
  "data_classification" : "FACTUAL_DATA",
  "schema" : {
    "columns" : [ {
      "column_name" : "test_int",
      "column_data_type" : "INT",
      "column_data_type_setting" : "",
      "column_type" : "PHYSICAL",
      "column_type_setting" : "",
      "nullable" : true,
      "array" : false,
      "depth" : 0,
      "parent_name" : ""
    }, {
      "column_name" : "test_time",
      "column_data_type" : "TIMESTAMP",
      "column_data_type_setting" : 3,
      "column_type" : "PHYSICAL",
      "column_type_setting" : "",
      "nullable" : false,
      "array" : false,
      "depth" : 0
    } ],
    "primary_key" : [ ],
    "partition" : [ ],
    "watermark_column" : "test_time",
    "watermark_interval" : 5,
    "time_filter" : "test_time"
  },
  "storage_setting" : {
    "streaming_bandwidth" : 0.5,
    "streaming_partition" : 1,
    "index_shards" : 1,
    "index_storage_period" : 3,
    "index_storage_size" : 100,
    "lake_storage_period" : 180,
    "lake_partition_setting" : "HOUR"
  },
  "display_setting" : {
    "columns" : [ {
      "column_name" : "test_int",
      "column_alias" : "",
      "display_by_default" : true
    }, {
      "column_name" : "test_time",
      "column_alias" : "",
      "display_by_default" : true
    } ],
    "format" : "TABLE"
  }
}

Example Responses

Status code: 200

Successful.

{
  "category" : "INDEX",
  "create_time" : 1768534974989,
  "data_classification" : "FACTUAL_DATA",
  "data_layering" : "ODS",
  "delete_time" : 0,
  "description" : "",
  "directory" : "",
  "display_setting" : {
    "columns" : [ {
      "column_alias" : "",
      "column_name" : "test_int",
      "display_by_default" : true
    }, {
      "column_alias" : "",
      "column_name" : "test_time",
      "display_by_default" : true
    } ],
    "format" : "TABLE"
  },
  "format" : "JSON",
  "owner_type" : "USER",
  "process_status" : "CREATING",
  "project_id" : "c796dfc5f1644915ae072b7642a2cd93",
  "rw_type" : "READ_WRITE",
  "schema" : {
    "columns" : [ {
      "array" : false,
      "column_data_type" : "INT",
      "column_data_type_setting" : "",
      "column_name" : "test_int",
      "column_sequence_number" : 0,
      "column_type" : "PHYSICAL",
      "column_type_setting" : "",
      "depth" : 0,
      "nullable" : true,
      "own_name" : "test_int",
      "parent_name" : ""
    }, {
      "array" : false,
      "column_data_type" : "TIMESTAMP",
      "column_data_type_setting" : "3",
      "column_name" : "test_time",
      "column_sequence_number" : 0,
      "column_type" : "PHYSICAL",
      "column_type_setting" : "",
      "depth" : 0,
      "nullable" : false,
      "own_name" : "test_time",
      "parent_name" : ""
    } ],
    "partition" : [ ],
    "primary_key" : [ ],
    "time_filter" : "test_time",
    "watermark_column" : "test_time",
    "watermark_interval" : 5
  },
  "storage_setting" : {
    "index_replicas" : 1,
    "index_shards" : 1,
    "index_storage_period" : 3,
    "index_storage_size" : 100
  },
  "table_alias" : "test_alias_2",
  "table_id" : "ff5b2a6f-4e21-4d57-b104-ce9e23822e62",
  "table_name" : "i_test_table",
  "update_time" : 1768534974989,
  "workspace_id" : "5317af6c-aea0-4bd2-bd6b-08de5fd3b155"
}

SDK Sample Code

The SDK sample code is as follows.

Create a table.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.secmaster.v2.region.SecMasterRegion;
import com.huaweicloud.sdk.secmaster.v2.*;
import com.huaweicloud.sdk.secmaster.v2.model.*;

import java.util.List;
import java.util.ArrayList;

public class CreateTableSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        SecMasterClient client = SecMasterClient.newBuilder()
                .withCredential(auth)
                .withRegion(SecMasterRegion.valueOf("<YOUR REGION>"))
                .build();
        CreateTableRequest request = new CreateTableRequest();
        request.withWorkspaceId("{workspace_id}");
        CreateTableRequestBody body = new CreateTableRequestBody();
        List<TableColumnDisplaySetting> listDisplaySettingColumns = new ArrayList<>();
        listDisplaySettingColumns.add(
            new TableColumnDisplaySetting()
                .withColumnName("test_int")
                .withColumnAlias("")
                .withDisplayByDefault(true)
        );
        listDisplaySettingColumns.add(
            new TableColumnDisplaySetting()
                .withColumnName("test_time")
                .withColumnAlias("")
                .withDisplayByDefault(true)
        );
        TableDisplaySetting displaySettingbody = new TableDisplaySetting();
        displaySettingbody.withColumns(listDisplaySettingColumns)
            .withFormat(TableDisplaySetting.FormatEnum.fromValue("TABLE"));
        TableStorageSetting storageSettingbody = new TableStorageSetting();
        storageSettingbody.withStreamingBandwidth(java.math.BigDecimal.valueOf(0.5))
            .withStreamingPartition(1)
            .withIndexStoragePeriod(3)
            .withIndexStorageSize(100)
            .withIndexShards(1)
            .withLakeStoragePeriod(180L)
            .withLakePartitionSetting(TableStorageSetting.LakePartitionSettingEnum.fromValue("HOUR"));
        List<IsapTableColumn> listSchemaColumns = new ArrayList<>();
        listSchemaColumns.add(
            new IsapTableColumn()
                .withColumnName("test_int")
                .withColumnType(IsapTableColumn.ColumnTypeEnum.fromValue("PHYSICAL"))
                .withColumnTypeSetting("")
                .withColumnDataType(IsapTableColumn.ColumnDataTypeEnum.fromValue("INT"))
                .withColumnDataTypeSetting("")
                .withNullable(true)
                .withArray(false)
                .withDepth(0)
                .withParentName("")
        );
        listSchemaColumns.add(
            new IsapTableColumn()
                .withColumnName("test_time")
                .withColumnType(IsapTableColumn.ColumnTypeEnum.fromValue("PHYSICAL"))
                .withColumnTypeSetting("")
                .withColumnDataType(IsapTableColumn.ColumnDataTypeEnum.fromValue("TIMESTAMP"))
                .withColumnDataTypeSetting("3")
                .withNullable(false)
                .withArray(false)
                .withDepth(0)
        );
        IsapTableSchema schemabody = new IsapTableSchema();
        schemabody.withColumns(listSchemaColumns)
            .withWatermarkColumn("test_time")
            .withWatermarkInterval(5f)
            .withTimeFilter("test_time");
        body.withDisplaySetting(displaySettingbody);
        body.withStorageSetting(storageSettingbody);
        body.withSchema(schemabody);
        body.withDataClassification(CreateTableRequestBody.DataClassificationEnum.fromValue("FACTUAL_DATA"));
        body.withDirectoryFr("");
        body.withDirectoryEn("");
        body.withDirectory("");
        body.withDescription("");
        body.withFormat(CreateTableRequestBody.FormatEnum.fromValue("JSON"));
        body.withCategory(CreateTableRequestBody.CategoryEnum.fromValue("INDEX"));
        body.withTableAlias("test_alias_2");
        body.withTableName("i_test_table");
        request.withBody(body);
        try {
            CreateTableResponse response = client.createTable(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Create a table.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdksecmaster.v2.region.secmaster_region import SecMasterRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdksecmaster.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = SecMasterClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = CreateTableRequest()
        request.workspace_id = "{workspace_id}"
        listColumnsDisplaySetting = [
            TableColumnDisplaySetting(
                column_name="test_int",
                column_alias="",
                display_by_default=True
            ),
            TableColumnDisplaySetting(
                column_name="test_time",
                column_alias="",
                display_by_default=True
            )
        ]
        displaySettingbody = TableDisplaySetting(
            columns=listColumnsDisplaySetting,
            format="TABLE"
        )
        storageSettingbody = TableStorageSetting(
            streaming_bandwidth=0.5,
            streaming_partition=1,
            index_storage_period=3,
            index_storage_size=100,
            index_shards=1,
            lake_storage_period=180,
            lake_partition_setting="HOUR"
        )
        listColumnsSchema = [
            IsapTableColumn(
                column_name="test_int",
                column_type="PHYSICAL",
                column_type_setting="",
                column_data_type="INT",
                column_data_type_setting="",
                nullable=True,
                array=False,
                depth=0,
                parent_name=""
            ),
            IsapTableColumn(
                column_name="test_time",
                column_type="PHYSICAL",
                column_type_setting="",
                column_data_type="TIMESTAMP",
                column_data_type_setting="3",
                nullable=False,
                array=False,
                depth=0
            )
        ]
        schemabody = IsapTableSchema(
            columns=listColumnsSchema,
            watermark_column="test_time",
            watermark_interval=5,
            time_filter="test_time"
        )
        request.body = CreateTableRequestBody(
            display_setting=displaySettingbody,
            storage_setting=storageSettingbody,
            schema=schemabody,
            data_classification="FACTUAL_DATA",
            directory_fr="",
            directory_en="",
            directory="",
            description="",
            format="JSON",
            category="INDEX",
            table_alias="test_alias_2",
            table_name="i_test_table"
        )
        response = client.create_table(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Create a table.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := secmaster.NewSecMasterClient(
        secmaster.SecMasterClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.CreateTableRequest{}
	request.WorkspaceId = "{workspace_id}"
	columnNameColumns:= "test_int"
	columnAliasColumns:= ""
	displayByDefaultColumns:= true
	columnNameColumns1:= "test_time"
	columnAliasColumns1:= ""
	displayByDefaultColumns1:= true
	var listColumnsDisplaySetting = []model.TableColumnDisplaySetting{
        {
            ColumnName: &columnNameColumns,
            ColumnAlias: &columnAliasColumns,
            DisplayByDefault: &displayByDefaultColumns,
        },
        {
            ColumnName: &columnNameColumns1,
            ColumnAlias: &columnAliasColumns1,
            DisplayByDefault: &displayByDefaultColumns1,
        },
    }
	formatDisplaySetting:= model.GetTableDisplaySettingFormatEnum().TABLE
	displaySettingbody := &model.TableDisplaySetting{
		Columns: &listColumnsDisplaySetting,
		Format: &formatDisplaySetting,
	}
	streamingBandwidthStorageSetting:= float32(0.5)
	streamingPartitionStorageSetting:= int32(1)
	indexStoragePeriodStorageSetting:= int32(3)
	indexStorageSizeStorageSetting:= int32(100)
	indexShardsStorageSetting:= int32(1)
	lakeStoragePeriodStorageSetting:= int64(180)
	lakePartitionSettingStorageSetting:= model.GetTableStorageSettingLakePartitionSettingEnum().HOUR
	storageSettingbody := &model.TableStorageSetting{
		StreamingBandwidth: &streamingBandwidthStorageSetting,
		StreamingPartition: &streamingPartitionStorageSetting,
		IndexStoragePeriod: &indexStoragePeriodStorageSetting,
		IndexStorageSize: &indexStorageSizeStorageSetting,
		IndexShards: &indexShardsStorageSetting,
		LakeStoragePeriod: &lakeStoragePeriodStorageSetting,
		LakePartitionSetting: &lakePartitionSettingStorageSetting,
	}
	columnNameColumns2:= "test_int"
	columnTypeColumns:= model.GetIsapTableColumnColumnTypeEnum().PHYSICAL
	columnTypeSettingColumns:= ""
	columnDataTypeColumns:= model.GetIsapTableColumnColumnDataTypeEnum().INT
	columnDataTypeSettingColumns:= ""
	nullableColumns:= true
	arrayColumns:= false
	depthColumns:= int32(0)
	parentNameColumns:= ""
	columnNameColumns3:= "test_time"
	columnTypeColumns1:= model.GetIsapTableColumnColumnTypeEnum().PHYSICAL
	columnTypeSettingColumns1:= ""
	columnDataTypeColumns1:= model.GetIsapTableColumnColumnDataTypeEnum().TIMESTAMP
	columnDataTypeSettingColumns1:= "3"
	nullableColumns1:= false
	arrayColumns1:= false
	depthColumns1:= int32(0)
	var listColumnsSchema = []model.IsapTableColumn{
        {
            ColumnName: &columnNameColumns2,
            ColumnType: &columnTypeColumns,
            ColumnTypeSetting: &columnTypeSettingColumns,
            ColumnDataType: &columnDataTypeColumns,
            ColumnDataTypeSetting: &columnDataTypeSettingColumns,
            Nullable: &nullableColumns,
            Array: &arrayColumns,
            Depth: &depthColumns,
            ParentName: &parentNameColumns,
        },
        {
            ColumnName: &columnNameColumns3,
            ColumnType: &columnTypeColumns1,
            ColumnTypeSetting: &columnTypeSettingColumns1,
            ColumnDataType: &columnDataTypeColumns1,
            ColumnDataTypeSetting: &columnDataTypeSettingColumns1,
            Nullable: &nullableColumns1,
            Array: &arrayColumns1,
            Depth: &depthColumns1,
        },
    }
	watermarkColumnSchema:= "test_time"
	watermarkIntervalSchema:= float32(5)
	timeFilterSchema:= "test_time"
	schemabody := &model.IsapTableSchema{
		Columns: &listColumnsSchema,
		WatermarkColumn: &watermarkColumnSchema,
		WatermarkInterval: &watermarkIntervalSchema,
		TimeFilter: &timeFilterSchema,
	}
	dataClassificationDataClassification:= model.GetDataClassificationDataClassificationEnum().FACTUAL_DATA
	directoryFrCreateTableRequestBody:= ""
	directoryEnCreateTableRequestBody:= ""
	directoryCreateTableRequestBody:= ""
	descriptionCreateTableRequestBody:= ""
	request.Body = &model.CreateTableRequestBody{
		DisplaySetting: displaySettingbody,
		StorageSetting: storageSettingbody,
		Schema: schemabody,
		DataClassification: &dataClassificationDataClassification,
		DirectoryFr: &directoryFrCreateTableRequestBody,
		DirectoryEn: &directoryEnCreateTableRequestBody,
		Directory: &directoryCreateTableRequestBody,
		Description: &descriptionCreateTableRequestBody,
		Format: model.GetCreateTableRequestBodyFormatEnum().JSON,
		Category: model.GetCreateTableRequestBodyCategoryEnum().INDEX,
		TableAlias: "test_alias_2",
		TableName: "i_test_table",
	}
	response, err := client.CreateTable(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Successful.

400

Error response.

Error Codes

See Error Codes.