Shape / columns · All operations

Rename columns

A variant of Choose and rename columns

Give chosen columns new names, one by one or from old-name and new-name pairs.

Status

In arcform

Runs as a SQL step

arcform carries it as a sql: step today.

The DuckDB step

Rename columns from old-name and new-name pairs

It reads the orders table the proofs share. Create it first:

SQL
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);

Then run the statement:

SQL
CREATE TEMP TABLE result AS
SELECT * RENAME (customer AS customer_name, amount AS total) FROM orders;
SELECT order_id, customer_name, total FROM result;
SELECT CASE WHEN ((SELECT list(column_name) FROM (DESCRIBE result)) = ['order_id', 'customer_name', 'region', 'order_date', 'total', 'product', 'tags', 'meta'] AND (SELECT sum(total) FROM result) = 1900.74) THEN 'as expected' ELSE error('the two columns were not renamed in place with their values unchanged') END AS verdict;
  • It needs nothing installed beyond DuckDB itself.
  • The statement checks its own result and raises an error when it is wrong: “the two columns were not renamed in place with their values unchanged”.
  • It passed on DuckDB v2.0.0 (Cyanoptera) d54cbbe3df.

What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

Apache DataFusion (3)
  • ASread 2026-09-27

    Pipe: alias the input relation, BigQuery-style |> syntax

  • aliasread 2026-09-27

    DataFrame method: Apply an alias to the DataFrame

  • with_column_renamedread 2026-09-27

    DataFrame method: Rename one column

Apache NiFi (1)
  • RenameRecordFieldread 2026-09-27

    Rename the fields selected by RecordPath in each record

AWS Glue (2)
Bruin (1)
Duckle (1)
EasyMorph (1)
Ibis (1)
  • Aliasread 2026-09-27

    Give an expression its output column name

KNIME Analytics Platform (2)
OpenRefine (1)
Polars (2)
  • DataFrame.renameread 2026-09-27

    Rename columns by a mapping or a function

  • Expr.aliasread 2026-09-27

    Give the output of an expression a new column name

Power Query M (1)
RapidMiner Studio (2)
Tableau Prep (1)
Trifacta (2)
  • Rename Transformread 2026-09-27

    Rename columns, or add a prefix or suffix to their names

  • Rename columnsread 2026-09-27

    Rename one or more columns by hand

VisiData (1)

Background

In relational algebra, a rename returns a relation identical to the input except that one attribute, in every tuple, is given a new name.[1]

When to use it

Rename when a source's names are cryptic, clash with another table's columns, or will not match by name the table they are meant to join or union with. (Meridian's view) In DuckDB, ALTER TABLE RENAME COLUMN renames a column of a stored table, and constraints that rely on the name, such as CHECK constraints, are updated automatically.[2] In DuckDB, views that rely on a column name are not automatically updated when ALTER TABLE renames that column.[2] Rename in the query when one consumer wants a different name, and rename the stored column only when the name is wrong for everyone, then rebuild the views that read it. (Meridian's view)

In DuckDB, identifiers are always case-insensitive, quoted identifiers included, so col_A and col_a are equal.[3]

The method

In relational algebra, the rename operator is written ρa/b(R), where R is a relation, b is an attribute of R and a is the name it is renamed to.[1] In relational algebra, a second notation, ρx(A1, …, An)(R), renames the relation R to x and its attributes to A1 to An.[1] In DuckDB, an expression in the SELECT clause can be named explicitly with AS, as in expr AS name, and is named automatically by the system when no name is given.[4] In Polars, DataFrame.rename takes key value pairs that map old names to new names, or a function that takes the old name and returns the new name.[5]

Compared with the alternatives

In DuckDB, the REPLACE clause of a star expression replaces specific columns by alternative expressions, as in REPLACE (col1 / 1_000 AS col1).[6]