创建表
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
Action | String | 是 | CreateTable | 要执行的操作,取值:CreateTable。 |
Version | String | 是 | 2025-05-31 | API的版本,取值:2025-05-31。 |
ClusterName | String | 是 | bytehouse_cluster_name | 集群名称 |
DatabaseName | String | 是 | database_name | 数据库名称 |
name | String | 是 | table_name | 表名 |
description | String | 否 | this is a table description | 表描述 |
engine | String | 是 | HaMergeTree | 表引擎 |
orderByKeys | Array of String | 是 | ["age", "name"] | 排序键 |
shardKey | String | 否 | age | 分片键 |
columns | Array of Object | 是 | [ { "name": "age", "type": "UInt64", "nullable": false, "defaultValue": "1" }, { "name": "name", "type": "String", "nullable": false }, { "name": "time", "type": "Date", "nullable": false }, { "name": "delete", "type": "String", "nullable": false }, { "name": "rename", "type": "String", "nullable": false }, { "name": "modify", "type": "String", "nullable": false } ] | 表列信息 |
partitionKeys | Array of Object | 否 | [ { "column": "time", "granularity": "DAY" } ] | 分区键 |
primaryKeys | Array of String | 否 | ["age"] | 主键,非必填,不填与排序键保持一致 |
clusterBy | Object | 否 | { "expr": "intHash64(age)", "numBuckets": 256 } | 分桶键 |
ttl | Object | 否 | { "column": "time", "granularity": "DAY", "value": 7, "unit": "DAY" } | 表过期时间设置 |
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
Data | Object | { | 建表返回 |
POST /?Action=CreateTable&Version=2025-05-31&ClusterName=bytehouse_cluster_name&DatabaseName=database_name HTTP/1.1 Host: bytehouse-ce.cn-beijing.volcengineapi.com Content-Type: application/json; charset=UTF-8 X-Date: 20260129T081816Z X-Content-Sha256: 287e874e******d653b44d21e Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20260129/cn-beijing/bytehouse_ce/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f { "name": "table_name", "engine": "HaMergeTree", "orderByKeys": [ "age", "name" ], "columns": [ { "name": "age", "type": "UInt64", "nullable": false, "defaultValue": "1" }, { "name": "name", "type": "String", "nullable": false } ] }
{ "ResponseMetadata": { "RequestId": "20260129161906041173143047F95248", "Action": "CreateTable", "Version": "2025-05-31", "Service": "bytehouse_ce", "Region": "cn-beijing" }, "Result": { "Data": { "uuid": "2238886" } } }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码 | 错误码 | 说明 |
|---|---|---|
400 | Bad Request | 参数错误 |
500 | InternalError |