Integrate one-click table creation templates

Updated at:

This topic describes how to configure DDL templates for output components in offline integration tasks to enable one-click table creation.

How it works

When you configure the output component of an offline integration task, if the destination table does not exist, you can use one-click table creation to create the destination table. The system then automatically generates the table creation statement by replacing placeholders in the DDL template with data from the source table's schema.

By configuring DDL templates for each output component, you can maintain and standardize table creation rules and common syntax within your tenant. If an output component does not have a custom template, the system uses its default template. A custom template always overrides the default.

Supported output components

You can configure DDL templates for the following output components: MySQL, Oracle, PostgreSQL, Hive (for Hive, Hudi, Iceberg, and Paimon tables), MaxCompute (for standard and Delta tables), AnalyticDB for MySQL 3.0, AnalyticDB for PostgreSQL, OushuDB, Hologres, TDH Inceptor, DM, openGauss, StarRocks, Greenplum, ArgoDB, Doris, SelectDB, Lindorm, GaussDB(DWS), Databricks, Amazon Redshift, Amazon RDS for PostgreSQL, Amazon RDS for MySQL, Amazon RDS for Oracle, TDSQL for MySQL, TDSQL for PostgreSQL, DolphinDB, PolarDB-X 2.0, GBase 8c, and Snowflake.

For Hive and MaxCompute, you can configure DDL templates separately for each table type.

Procedure

  1. On the Dataphin homepage, in the top navigation bar, choose management center > standard settings.

  2. In the left-side navigation pane, choose development specification > integrate one-click table creation templates.

  3. Select the target output component from the list.

  4. Click Edit to modify the DDL template for the selected output component. For a list of supported placeholders, see the Supported placeholders section.

    For Hive and MaxCompute, switch to the tab for the target table type and edit the template for each type.

    Note
    • A single DDL template cannot exceed 1024 characters.

    • The system validates the placeholders in your template but does not perform a strict validation of its SQL syntax.

  5. After you finish editing, click Save.

Supported placeholders

The system generates a table creation statement by replacing placeholders in the template with data from the source table's schema. The following placeholders are supported.

Placeholder

Description

${tableName}

This is the table name that you specify in the output component's configuration.

${fieldList}

The field list. The system generates this list by iterating through the fields in the source table. The format includes the field name, field type, and field comment. The system converts field types based on the type mapping between the source and destination.

${tableComment}

The comment from the source table.

${columnComments}

The column comment statements. The system generates separate column comment statements by iterating through the fields in the source table. This is suitable for databases where comments must be declared separately, such as PostgreSQL and Oracle. You do not need this placeholder for databases where comments are defined within the field list.

${firstField}

The first field in the field list. Use it for a primary key or distribution key. You can also replace it with a specified field in the template.

Unlike other table elements, partition fields do not have a dedicated placeholder. You must specify the partition field, such as ds, directly in the template.