You can execute the create table statement to create a mapping table for an existing data table or search index.

Note For more information about the create table statement, see Create mapping tables for tables.

Prerequisites

A Tablestore client is initialized. For more information, see Initialization.

Parameters

Parameter Description
query The SQL statement. Configure the parameter based on the required feature.

Examples

Execute the create table test_table (pk varchar(1024), long_value bigint, double_value double, string_value mediumtext, bool_value bool, primary key(pk)) statement to create a mapping table for the table named test_table.

func createMappingTable(client *tablestore.TableStoreClient) {
    // Create a SQL request. 
    request := &tablestore.SQLQueryRequest{Query: "create table test_table (pk varchar(1024), long_value bigint, double_value double, string_value mediumtext, bool_value bool, primary key(pk))"}

    // Obtain the response to the SQL request. 
    response, err := client.SQLQuery(request)
}