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, Parquet, or database tables, column names support alphanumeric characters and the underscore (_) character only. 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. |
To rename a column, click the drop-down caret next to the column name. Click Rename.
Steps:
newColumnName
value with your preferred column name.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
udf
- See User-Defined Functions.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.
Tip: To prevent potential issues with downstream systems, you should limit your column lengths to no more than 128 characters. |
Steps:
Rename columns
.The following methods can be applied to renaming multiple columns.
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. Example:
Old Column Name | Prefix | New Column Name |
---|---|---|
column1 | pre_ | pre_column1 |
column2 | pre_ | pre_column2 |
column3 | pre_ | pre_column3 |
For the selected columns, you can apply a specific suffix value to the names. Example:
Old Column Name | Suffix | New Column Name |
---|---|---|
column1 | _new | column1_new |
column2 | _new | column2_new |
column3 | _new | column3_new |
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. For more information on patterns, 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. |
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:
_
).