All Products
Search
Document Center

Tablestore:Create mapping tables

Last Updated:Nov 03, 2023

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

Note

For more information about the CREATE TABLE statement, see Create mapping tables for tables and Create mapping tables for search indexes.

Prerequisites

An OTSClient instance is initialized. For more information, see Initialization.

Parameters

Parameter

Description

query

The SQL statement. Specify the parameter based on the required feature.

Example

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.

def create_mapping_table(client):
    query = 'create table test_table (pk varchar(1024), long_value bigint, double_value double, string_value mediumtext, bool_value bool, primary key(pk))'
    client.exe_sql_query(query)