Shape · Columns
Rename
Gives columns new names. Type old-to-new pairs, or let the data decide at run time: take the names from the first row (which is then dropped), from a names table on a second input, or from an expression over each old name.
Also known as: Relabel, alias
How it works
With New names come from set to Names I type (the default), click Add mapping and fill one column and New name pair per column; unlisted columns keep their names and a pair whose new name equals the old one does nothing. The other three options decide the names at run time for the columns you pick under Rename these columns, or for every column except them with Rename every column except these (the default, every column when the list is empty): The first row uses that row's values as names and drops the row; A names table (second input) reads the New-name column of the table wired into the names input, matched to the old names by the Old-name column or by position when it is blank; An expression over each name evaluates a DuckDB SQL expression in which name is the old name. A name that comes out empty becomes Field_ plus the column count plus one, and a name already taken gets a number, as in YDS2.
Inputs and outputs
Inputs
data— Tablenames— Table
Outputs
data— Table
Settings
The Attributes panel of Rename, as in the app: the controls work, but nothing runs — there is no data behind it.
The same settings, as the Assistant writes them
{
mappings: [{ from: string, to: string }]
namesFrom?: "fixed"|"first-row"|"names-input"|"expression"
columns?: string[]
exceptColumns?: boolean
expression?: string
newNameColumn?: string
oldNameColumn?: string
}namesFrom other than "fixed" picks the new names at run time for `columns` (exceptColumns: true = every column except those; the default): "first-row" = the first row's values, and that row is dropped; "names-input" = the `newNameColumn` of the table wired into the `names` input, matched by `oldNameColumn` or, when empty, by position; "expression" = a DuckDB SQL expression over `name`, e.g. "replace(name, '_', ' ')". An empty new name becomes Field_<column count + 1>; a taken one gets a number (name2, Field_8_2).
Example
A warehouse export uses snake_case headers and the report wants readable ones. Choose An expression over each name and enter replace(name, '_', ' '), so order_date becomes order date and unit_price becomes unit price without listing each column.