Renames a table in place with ALTER TABLE ... RENAME TO, a
metadata-only change.
Details
History survives the rename, but snapshots from before it stay
associated with the old name: get_ducklake_table_version() on the new
name reaches back only as far as the rename, while the old name still
serves the earlier snapshots.
See also
Other schema evolution:
add_table_column(),
drop_table_column(),
rename_table_column(),
set_column_not_null(),
set_column_type()
Examples
lake_dir <- tempfile("renametbl_lake_")
dir.create(lake_dir)
attach_ducklake("renametbl_lake", lake_path = lake_dir)
create_table(mtcars, "cars")
rename_ducklake_table("cars", "cars_daily")
#> Renamed table "cars" to "cars_daily".
#> ℹ Snapshots from before the rename remain queryable under the old name.
detach_ducklake("renametbl_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)
