In the , you can rename individual columns through the column drop-down. Through transform steps, you can apply renaming to one or more columns.
\n
.NOTE: When publishing to Avro, column names support alphanumeric characters and the underscore (_) character only. Column names cannot begin with a numeral. Other characters cause an error to occur. |
NOTE: Column names with spaces or special characters in a transformation must be wrapped by curly braces. Example:
|
Tip: To prevent potential issues with downstream systems, you should limit your column lengths to no more than 128 characters. |
The following keywords should not be used as column names, as they may conflict with underlying requirements of the platform or the running environments with which it integrates:
NOTE: This list may not be complete. If your job fails with a duplicate column error, please review your column names to identify potential reserved keywords among them. |
TRIFACTA__LINEAGE_INFO
TRIFACTA__FILE_LINEAGE_INFO
NOTE: There are two underscore characters in a row (__) after |
To rename a column, click the drop-down caret next to the column name. Click Rename.
Steps:
newColumnName
value with your preferred column name.You can use the following transformation to rename a single column through the Transform Builder. In this case, the Rename columns transformation is used to perform a manual rename of MySourceCol
to MyNewCol
.
Columns that are generated through transform steps are given a default name.
For the following types of transforms, however, you can specify the column name as part of the step:
derive
extractkv
merge
nest
When a transform is added to the recipe, an as:
clause is automatically added to the transform step. You can modify your transform to change the value of the as:
column. For example, the following transform generates a new column with the first word from the Name
column. The as:
value renames this generated column as FirstName
:
When your transforms generate new columns, names are automatically assigned to these columns based on the following pattern.
If the transform includes a function reference, the function name is included in the new column. Example:
New column name: left_city
If the above step is applied again, a duplicate column is generated with the following name. Example:
New column name: left_city1
If the transform does not contain a function reference, the following convention is used:
New column name: column1
New column name: column2
enables to rename multiple columns using a single transformation. You can perform this batch renaming using one of the methods described in this section.
NOTE: In macros, Rename Columns transformations do not work. This is a known issue. |
Tip: To prevent potential issues with downstream systems, you should limit your column lengths to no more than 128 characters. |
Steps:
Rename columns
.Select the column or columns to which to apply the rename.
Tip: To apply the renaming across all columns in the dataset, select All. This option is useful for pattern-based renames, such as adding a prefix or changing case. |
For each column that you select, you must add the new name just below the old one.
For the selected columns, you can apply a specific prefix value to the names.
Old Column Names | Prefix | New Column Names |
---|---|---|
column1 | pre_ | pre_column1 |
column2 | pre_ | pre_column2 |
column3 | pre_ | pre_column3 |
Transformation:
For the selected columns, you can apply a specific suffix value to the names. Example:
Old Column Names | Suffix | New Column Names |
---|---|---|
column1 | _new | column1_new |
column2 | _new | column2_new |
column3 | _new | column3_new |
Transformation:
The following transformation performs the same rename as the previous one. Instead, it uses the All option to apply the rename across all columns of the dataset. If the number of columns changes in the future, then the rename is still applied across all of the columns in the dataset.
Transformation:
For the selected columns, you can convert the columns names to lowercase. Example:
Old Column Names | New Column Names |
---|---|
Daily | daily |
POS_Cost | pos_cost |
Sales_Type | sales_type |
Transformation:
For example, if the old column name is Sales_Type
, then the new column name is renamed to sales_type
.
For the selected columns, you can convert the columns names to uppercase. Example:
Old Column Names | New Column Names |
---|---|
Daily |
|
POS_Cost | POS_COST |
Sales_Type | SALES_TYPE |
Transformation:
For example, if the old column name is Sales_Type
, then the new column name is renamed to SALES_TYPE
.
For the selected columns, you can specify the number of characters to keep from the beginning (left) of the column names. Based on the number of characters you provide, the column name is updated. Example:
Old Column Names | Number of characters | New Column Names |
---|---|---|
Daily | 3 |
|
POS_Cost | 3 | POS |
Sales_Type | 3 | Sal |
Transformation:
For example, if the old column name is Sales_Type
, then based on the number of characters to keep from the beginning (left) is 3, then new column name is renamed to Sal
.
For the selected columns, you can specify the number of characters to keep from end (right) of the column names. Based on the number of characters you provide, the column name is updated. Example:
Old Column Names | Number of characters | New Column Names |
---|---|---|
Daily | 4 |
|
POS_Cost | 4 | Cost |
Sales_Type | 4 | Type |
Transformation:
For example, if the old column name is Sales_Type
, then based on the number of characters to keep from the end (right) is 4, then new column name is renamed to Type
.
NOTE: If the number of characters are more than the length of the column names, then the whole name of the column is retained. |
You can apply literals, , or regular expressions to match patterns of text in the source column names. These matching values can then be replaced by a fixed value.
Tip: The default behavior is to replace the first instance. Use the Match all occurrences checkbox to apply the pattern matching across all columns in your set. |
For the selected columns, you can specify the number of characters to keep from end (right) of the column names. Based on the number of characters you provide, the column name is updated. Example:
Old Column Names | New Column Names |
---|---|
column1 |
|
column2 |
|
column3 |
|
Transformation:
The above uses literal values for find and replace. For more information on pattern-based matching, see Text Matching.
When this method is applied, all of the values in the specified row or rows are used as the new names for each column.
NOTE: This method applies to all columns in the dataset. |
Types:
Type | Description | |
---|---|---|
Use a single row to rename columns | Specify the row number in the sample to use as the source for column names.
| |
Use the first row in the sample to rename columns | Use the first row in the sample as the name for all columns. | |
Combine multiple rows to rename columns | Specify two or more rows to combine into column names. Details are below.
|
Source row number information:
NOTE: If source row number information is no longer available, this method cannot be used for column rename. |
The following transformation renames the columns in the dataset based on the values in rows 3 and 4 of the data:
In the above:
_
). This value can be empty.