Domain name for API request: cdwdoris.tencentcloudapi.com.
This API is used to create a TCHouse-D table under the specified database.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateTable. |
Version | Yes | String | Common Params. The value used for this API: 2021-12-28. |
Region | No | String | Common Params. This parameter is not required for this API. |
InstanceId | Yes | String | Resource ID, which is the TCHouse-D resource ID used for table creation. |
DbName | Yes | String | The database where the table is located; if it does not exist, create one. |
TableName | Yes | String | Name of the table to be created |
KeysType | Yes | String | Table data model: AGG_KEY: aggregation model; UNI_KEY: primary key model; DUP_KEY: detail model |
Columns.N | Yes | Array of Column | Column information of the table |
Distribution | Yes | Distribution | Bucket information |
UserName | No | String | Use the user who has corresponding permissions for operations. If the TCHouse-D cluster uses a kernel account registered by a CAM user, you do not need to fill it in. |
PassWord | No | String | Password corresponding to the user. If the TCHouse-D cluster uses a kernel account registered by a CAM user, you do not need to fill it in. |
IndexInfos.N | No | Array of IndexInfo | Index information. The inverted index and N-Gram index can be configured through this parameter. The Prefix index is related to the sort key and key column, and do not require additional configuration. Configure bloom_filter_columns in the table attribute when BloomFilter index is required. |
Partition | No | Partition | Partition information |
TableComment | No | String | Table description |
Properties.N | No | Array of Property | Table attribute |
Parameter Name | Type | Description |
---|---|---|
Message | String | Note: This field may return null, indicating that no valid values can be obtained. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
建表-聚合模型
POST / HTTP/1.1
Host: cdwdoris.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateTable
<common request parameters>
{
"InstanceId": "cdwdoris-lrqz7cd4",
"DbName": "demo",
"TableName": "test",
"KeysType": "AGG_KEY",
"Columns": [
{
"Name": "user_id",
"Type": "LARGEINT",
"IsNull": false,
"IsKey": true,
"IsPartition": false,
"IsDistribution": true,
"Comment": "用户id"
},
{
"Name": "date",
"Type": "DATE",
"IsNull": false,
"IsKey": true,
"IsPartition": true,
"IsDistribution": false,
"Comment": "数据灌入日期时间"
},
{
"Name": "city",
"Type": "VARCHAR(20)",
"IsNull": true,
"IsKey": true,
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户所在城市"
},
{
"Name": "last_visit_date",
"Type": "DATETIME",
"AggType": "REPLACE",
"IsNull": false,
"IsKey": false,
"DefaultValue": "1970-01-01 00:00:00",
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户最后一次访问时间"
},
{
"Name": "cost",
"Type": "BIGINT",
"AggType": "SUM",
"IsNull": false,
"IsKey": false,
"DefaultValue": "0",
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户总消费"
}
],
"Distribution": {
"DistributionType": "Hash",
"Count": 3
},
"Partition": {
"PartitionType": "Range",
"AutoPartition": false,
"RangeInfos": [
{
"RangeType": "LESS THAN",
"PartitionName": "p201701",
"Max": "(\"2017-02-01\")"
},
{
"RangeType": "FIXED",
"PartitionName": "a202",
"Left": "(\"2017-02-02\")",
"Right": "(\"2017-03-01\")"
}
]
},
"TableComment": "example",
"Properties": [
{
"PropertyKey": "replication_allocation",
"PropertyValue": "tag.location.default: 1"
}
]
}
{
"Response": {
"Message": "",
"RequestId": "feef710c-431d-443b-b5fb-bc7ca25bfafd"
}
}
建表-明细模型
POST / HTTP/1.1
Host: cdwdoris.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateTable
<common request parameters>
{
"InstanceId": "cdwdoris-lrqz7cd4",
"DbName": "demo",
"TableName": "dup_test",
"KeysType": "DUP_KEY",
"Columns": [
{
"Name": "timestamp",
"Type": "DATETIME",
"IsNull": false,
"IsKey": true,
"IsPartition": false,
"IsDistribution": false,
"Comment": "日志时间"
},
{
"Name": "type",
"Type": "INT",
"IsNull": false,
"IsKey": true,
"IsPartition": false,
"IsDistribution": true,
"Comment": "日志类型"
},
{
"Name": "error_code",
"Type": "INT",
"IsNull": true,
"IsKey": true,
"IsPartition": false,
"IsDistribution": false,
"Comment": "错误码"
},
{
"Name": "error_msg",
"Type": "VARCHAR(1024)",
"IsNull": true,
"IsKey": false,
"IsPartition": false,
"IsDistribution": false,
"Comment": "错误详细信息"
},
{
"Name": "op_id",
"Type": "BIGINT",
"IsNull": true,
"IsKey": false,
"IsPartition": false,
"IsDistribution": false,
"Comment": "负责人id"
},
{
"Name": "op_time",
"Type": "DATETIME",
"IsNull": true,
"Comment": "处理时间"
}
],
"Distribution": {
"DistributionType": "Hash",
"Count": 1
},
"Properties": [
{
"PropertyKey": "replication_allocation",
"PropertyValue": "tag.location.default: 1"
}
]
}
{
"Response": {
"Message": "",
"RequestId": "1b12e7c9-4802-412c-b23b-5a2514f508a8"
}
}
建表-主键模型
POST / HTTP/1.1
Host: cdwdoris.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateTable
<common request parameters>
{
"InstanceId": "cdwdoris-lrqz7cd4",
"DbName": "demo",
"TableName": "uni_test1",
"KeysType": "UNI_KEY",
"Columns": [
{
"Name": "user_id",
"Type": "LARGEINT",
"IsNull": false,
"IsKey": true,
"IsPartition": false,
"IsDistribution": true,
"Comment": "用户id"
},
{
"Name": "username",
"Type": "VARCHAR(50)",
"IsNull": false,
"IsKey": true,
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户昵称"
},
{
"Name": "city",
"Type": "VARCHAR(20)",
"IsNull": true,
"IsKey": false,
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户所在城市"
},
{
"Name": "age",
"Type": "SMALLINT",
"IsNull": true,
"IsKey": false,
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户年龄"
},
{
"Name": "sex",
"Type": "TINYINT",
"IsNull": true,
"IsKey": false,
"IsPartition": false,
"IsDistribution": false,
"Comment": "用户性别"
},
{
"Name": "phone",
"Type": "LARGEINT",
"IsNull": true,
"Comment": "用户电话"
},
{
"Name": "address",
"Type": "VARCHAR(500)",
"IsNull": true,
"Comment": "用户地址"
},
{
"Name": "register_time",
"Type": "DATETIME",
"IsNull": true,
"Comment": "用户注册时间"
}
],
"Distribution": {
"DistributionType": "Hash",
"Count": 1
},
"Properties": [
{
"PropertyKey": "replication_allocation",
"PropertyValue": "tag.location.default: 1"
}
]
}
{
"Response": {
"Message": "",
"RequestId": "1e10c4a5-44cf-4833-be5b-cb5fb8217c43"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
There is no error code related to the API business logic. For other error codes, please see Common Error Codes.
本页内容是否解决了您的问题?