Creates a table in DLA by using Object Storage Service (OSS) as a data source.

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
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

Optional. The partition fields.

Comment String No this is partition keys

The remarks on the partitions in the table.

Name String No part_id001

The name of the partition key column.

Type String No string

The type of the partition key column.

Parameters Map No

The attributes of the table.

String No key001=value001

The values of table attributes.

StorageDescriptor Object Yes

The description for the storage of the table.

Cols Array Yes

The columns in the table.

Comment String Yes this is column comment

The remarks on the columns in the table.

Name String Yes col1

The name of the column.

Type String Yes string

The type of the column.

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 URL of the OSS bucket in which table data is stored.

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

The output format of the table.

Parameters Map Yes

The attributes of the storage space of the table.

String Yes key001=value001

The values of the attributes of the storage space of the table.

SerDeInfo Object Yes

The information of the serializer/deserializer (SerDe).

Name String Yes serDename

The name of the SerDe.

Parameters Map Yes

The attributes of the SerDe.

String Yes key001=value001

The values of SerDe attributes.

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

The class library used by the SerDe to perform serialization and deserialization.

ViewOriginalText String No select count(*) from tbl001

The original SQL statement used to query the view.

ViewExpandedText String No select count(*) from tbl001

The expanded SQL statement 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 is 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 is successful.

Examples

Sample requests

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

Sample success responses

XML format

<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

{
    "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.