tencent cloud

Feedback

GenHiveTableDDLSql

Last updated: 2024-06-21 15:10:56

1. API Description

Domain name for API request: wedata.tencentcloudapi.com.

Generate SQL for Creating Hive Table

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: GenHiveTableDDLSql.
Version Yes String Common Params. The value used for this API: 2021-08-20.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
ProjectId Yes String Project ID
SinkDatabase Yes String Target Database
Id No String Node ID
MsType No String Metadata Type (MYSQL,ORACLE)
DatasourceId No String Data source ID
SourceDatabase No String Source Library Name
TableName No String Source Table Name
SinkType No String Target Table Metadata Type (HIVE,GBASE)
SchemaName No String Source Schema Name
SourceFieldInfoList.N No Array of SourceFieldInfo Field Information of Upstream Node
Partitions.N No Array of Partition Partition Field
Properties.N No Array of Property Table Creation Attributes
TableMode No Integer Table Creation Mode,0: Wizard Mode,1: ddl
TableVersion No String DLC Table Version, v1/v2
UpsertFlag No Boolean Whether to Upsert Writes
TableComment No String Table Description Information
AddDataFiles No Integer Threshold for Increased Number of Files, Exceeding Value Will Trigger Small File Merge
AddEqualityDeletes No Integer Threshold for Increased Number of Equality Deletes, Exceeding Value Will Trigger Small File Merge
AddPositionDeletes No Integer Threshold for Increased Number of Position Deletes, Exceeding Value Will Trigger Small File Merge
AddDeleteFiles No Integer Threshold for Increased Number of Delete Files
TargetDatasourceId No String Downstream Node Data Source ID
UpsertKeys.N No Array of String DLC Upsert Primary Key
TableBaseInfo No TableBaseInfo DLC Table Governance Information
SinkSchemaName No String Target Schema Name

3. Output Parameters

Parameter Name Type Description
DDLSql String Generated DDL Statement
Data String Generated DDL Statement. Same meaning as DDLSql, prioritizing Data. If Data is null, then DDLSql is taken.
Note: This field may return null, indicating that no valid value 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.

4. Example

Example1 GenHiveTableDDLSql

Generate SQL for Creating Hive Table

Input Example

POST / HTTP/1.1
Host: wedata.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: GenHiveTableDDLSql
<Common request parameters>

{
    "Id": "",
    "ProjectId": "1486446569620893696",
    "MsType": "MYSQL",
    "DatasourceId": "915669",
    "SourceDatabase": "source_database_name",
    "TableName": "test_table_name",
    "SinkDatabase": "sink_database_name",
    "SinkType": "HIVE",
    "SchemaName": "test_schema_name",
    "SourceFieldInfoList": [
        {
            "FieldName": "name",
            "FieldType": "string",
            "Alias": "name"
        }
    ],
    "Partitions": [
        {
            "Transform": "identity",
            "Name": "id",
            "TransformArgs": [
                ""
            ]
        }
    ],
    "Properties": [
        {
            "Key": "format-version",
            "Value": "2"
        }
    ],
    "TableMode": 0,
    "TableVersion": "abc",
    "UpsertFlag": true,
    "TableComment": "Table Comments",
    "AddDataFiles": 0,
    "AddEqualityDeletes": 0,
    "AddPositionDeletes": 0,
    "AddDeleteFiles": 0,
    "TargetDatasourceId": "915792"
}

Output Example

{
    "Response": {
        "DDLSql": "CREATE TABLE IF NOT EXISTS `test_hive`.`test_table`(`id` bigint comment 'Primary Key ID',`name` string comment 'Name',`len` decimal(5,2),`a1` bigint)row format delimited fields terminated by '\\t' STORED AS PARQUET;",
        "Data": "CREATE TABLE IF NOT EXISTS `test_hive`.`test_table`(`id` bigint comment 'Primary Key ID',`name` string comment 'Name',`len` decimal(5,2),`a1` bigint)row format delimited fields terminated by '\\t' STORED AS PARQUET;",
        "RequestId": "53042adf-3bf5-4d52-aa48-9b91ef2ccaa7"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation Failure.