Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can rename individual columns through the column drop-down. Through transform steps, you can apply renaming to one or more columns.

D s minrows

Name Requirements

  • Column names are case-insensitive and cannot begin with whitespace.

...

  • Column names cannot contain escaped characters, such as \n.
Info

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.


Info

NOTE: Column names with spaces or special characters in a transformation must be wrapped by curly braces. Example:

Code Block
column1,{Column 2 with space},column3



Tip

Tip: To prevent potential issues with downstream systems, you should limit your column lengths to no more than 128 characters.

...

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:

d-

...

showNotetrue

...

trans
p03ValueFirstName
Typestep
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueFIND(Name,`{start} `,false,0)

...

p03NameNew column name
SearchTermNew formula

Auto-Generated Column Names

...

  1. If the transform includes a function reference, the function name is included in the new column.  

    Example TransformColumn Namederive type:single value:

    Example:

    D trans
    Typestep
    p01NameFormula type
    p01ValueSingle row formula
    p02NameFormula
    p02ValueLEFT(city,3)
    SearchTermNew formula


    New column name: left_city

     

  2. If the above step is applied again, a duplicate column is generated with the following name. Example:

    Example TransformColumn Namederive type:single value:

    D trans
    Typestep
    p01NameFormula type
    p01ValueSingle row formula
    p02NameFormula
    p02ValueLEFT(city,3)
    SearchTermNew formula


    New column name: left_city1

  3. derive type:single value:'5'

    If the transform does not contain a function reference, the following convention is used:

    Example TransformColumn Name
    derive type:single value:'4'
    column1


    D trans
    Typestep
    p01NameFormula type
    p01ValueSingle row formula
    p02NameFormula
    p02Value'A'
    SearchTermNew formula

    New column name: column1

    D trans
    Typestep
    p01NameFormula type
    p01ValueSingle row formula
    p02NameFormula
    p02Value'B'
    SearchTermNew formula

    New column name: column2

Rename Multiple Columns

D s product
 enables to rename multiple columns using a single transformation. You can perform this batch renaming using one of the methods described in this section.

...

You can apply literals, 

D s item
itempatterns
, 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.

Use row(s) as

...

column names

When this method is applied, all of the values in the specified row or rows are used as the new names for each column.

...

Info

NOTE: If source row number information is no longer available, this method cannot be used for column rename.

  • If a value is not applied for the source row number, the next row of data is used.
  • Source row numbers apply. Current row numbers may not be the same. In the data grid, mouse over the leftmost column to see available row information.
  • Each value in the row or combination of values across rows must be unique within the rowset of new column names.
  • The row is removed from its original position.

...

  • .

The following transformation renames the columns in the dataset based on the values in rows 3 and 4 of the data:

D trans
p03Value3
p06NameFill across?
p01NameOption
p06ValueSelected
p03NameRow Numbers - row A
p04Value4
SearchTermRename columns
Typestep
p05NameChoose your separator
p01ValueUse row(s) as column names
p02NameType
p02ValueCombine multiple rows to name columns
p05Value'_'
p04NameRow Numbers - row B

In the above:

  • The Separator is defined as an underscore character (_).
  • When Fill across is selected, if any row value is empty, the last non-empty value for the row in a previous column is used as part of the column header.