Creates an Object Storage Service (OSS) table.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateTable

The operation that you want to perform. Set the value to CreateTable.

DbName String Yes db001

The name of the database.

TableName String Yes tbl001

The name of the table that you want to create.

PartitionKeys Array No

The partition keys. This parameter is optional.

Comment String No this is partition keys

The comment of the partition.

Name String Yes part_id001

The name of the partition key column.

Type String Yes string

The data type of the partition key column.

Parameters Map No

The properties of the table.

String No key001=value001

The properties of the table.

StorageDescriptor Object Yes

The description for the storage of the table.

Cols Array Yes

The columns in the table.

Comment String No this is column comment

The comment of the column in the table.

Name String Yes col1

The name of the column in the table.

Type String Yes string

The data type of the column in the table.

InputFormat String Yes org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat

The input format of the table.

Location String Yes oss://data/warehouse/tblname

The OSS directory where table data is saved.

OutputFormat String Yes org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat

The output format of the table.

Parameters Map No

The serializer/deserializer (SerDe) properties.

String No key001=value001

The SerDe properties.

SerDeInfo Object Yes

The SerDe information of the table.

Name String No serDename

The SerDe name of the table.

Parameters Map No

The SerDe properties of the table.

String No key001=value001

The SerDe properties of the table.

SerializationLib String Yes org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe

The SerDe class library of the table.

ViewOriginalText String No select count(*) from tbl001

The original SQL statement that is used to query the view.

ViewExpandedText String No select count(*) from tbl001

The extended SQL statement that is used to query the view.

TableType String Yes VIEW

The type of the table. Valid values: VIEW, MANAGED_TABLE, EXTERNAL_TABLE, and VIRTUAL_VIEW.

Response parameters

Parameter Type Example Description
Code String ALREADY_EXISTS

The error code returned.

Data Long 1234

The ID of the table that was created.

Message String Table db001.tbl001 already exists

The error message returned.

RequestId String 9BEAC206-0795-4DE3-B1FD-964BEF432B23

The ID of the request.

Success Boolean false

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateTable
&DbName=db001
&TableName=tbl001
&PartitionKeys=[{"Comment":"this is partition keys","Name":"part_id001","Type":"string"}]
&Parameters={"key":"key001=value001"}
&StorageDescriptor={"Cols":[{"Comment":"this is column comment","Name":"col1","Type":"string"}],"InputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat","Location":"oss://data/warehouse/tblname","OutputFormat":"org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat","Parameters":{"key":"key001=value001"},"SerDeInfo":{"Name":"serDename","Parameters":{"key":"key001=value001"},"SerializationLib":"org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"}}
&ViewOriginalText=select count(*) from tbl001
&ViewExpandedText=select count(*) from tbl001
&TableType=VIEW
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<Message>Table db001.tbl001 already exists</Message>
<RequestId>9BEAC206-0795-4DE3-B1FD-964BEF432B23</RequestId>
<Data>1234</Data>
<Code>ALREADY_EXISTS</Code>
<Success>false</Success>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "Table db001.tbl001 already exists",
  "RequestId" : "9BEAC206-0795-4DE3-B1FD-964BEF432B23",
  "Data" : "1234",
  "Code" : "ALREADY_EXISTS",
  "Success" : "false"
}

Error codes

For a list of error codes, visit the API Error Center.