Skip to contents

Renames a column in place with ALTER TABLE ... RENAME COLUMN, a metadata-only change.

Usage

rename_table_column(table_name, from, to)

Arguments

table_name

The table to change.

from

Current column name.

to

New column name.

Value

Invisibly returns NULL.

Examples

lake_dir <- tempfile("renamecol_lake_")
dir.create(lake_dir)
attach_ducklake("renamecol_lake", lake_path = lake_dir)
create_table(mtcars, "cars")

rename_table_column("cars", from = "mpg", to = "miles_per_gallon")
#> Renamed column "mpg" to "miles_per_gallon" in "cars".

detach_ducklake("renamecol_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)