Defining a DDL Query to Create or Replace the Target at Run Time
Defining a DDL Query to Create or Replace the Target at Run Time
When you select the Target Schema Strategy option to create or replace the target at run time, you can define a DDL query based on which the Data Integration Service must create or replace the target table at run time. You can define a DDL query for relational and Hive targets. You can enter placeholders and parameters in the DDL query.
In the
Properties
view, click the
Advanced
tab.
Select
Create or replace table at runtime
from the
Target Schema Strategy
list.
The
DDL query
field is available.
Click
Edit
.
The
DDL query
dialog box appears.
Enter the DDL query in the editor.
You can enter placeholders in the DDL query. The Data Integration Service substitutes the placeholders with the actual values at run time. For example, if a table contains 50 columns, instead of entering all the column names in the DDL query, you can enter a placeholder.
You can enter the following placeholders in the DDL query:
INFA_TABLE_NAME. Fetches the target table name at run time.
INFA_COLUMN_LIST. Fetches a list of columns in the target table at run time.
INFA_PORT_SELECTOR. Adds port selectors.
The placeholder names are case sensitive. You must enclose the placeholders within two curly brackets. For example, {INFA_TABLE_NAME}.
You can also perform the following steps to define the DDL query.
To add a column name, double-click a column in the
Columns
tab.
To define a parameter, click the
Parameters
tab, and double-click a parameter name. You can also click
Manage Parameters
to add, edit, or delete parameters.
To configure a port selector, click the
Port Selector
tab, and double-click a port selector. You can also click
New
to configure a new port selector.
The following image shows a DDL query to create a Hive target table:
The DDL query in the image contains the INFA_TABLE_NAME, INFA_COLUMN_LIST, and INFA_PORT_SELECTOR placeholders. It also contains a parameter to define the storage format.
If you do not enter a DDL query, the Data Integration Service creates the target based on the mapping flow or data object.