Stores per-column descriptions in the DuckLake catalog with
COMMENT ON COLUMN, one name = "comment" pair per column. For data
with haven/labelled variable labels, create_table() can store the
labels automatically; this function adds or revises them afterward –
for example to label a derived variable.
Details
All comments from one call are written in a single transaction, so they
land as one snapshot. Inside with_transaction() they join the open
transaction instead.
DuckLake accepts column comments on tables only. A view takes a comment
of its own through set_table_comment(), but not on its columns.
See also
set_table_comment(), get_table_comments()
Other table documentation:
get_table_comments(),
set_table_comment()
Examples
lake_dir <- tempfile("colcomment_lake_")
dir.create(lake_dir)
attach_ducklake("colcomment_lake", lake_path = lake_dir)
create_table(mtcars, "cars")
set_column_comments(
"cars",
mpg = "Miles per US gallon",
cyl = "Number of cylinders",
disp = NA # clear this one
)
#> Commented 3 columns on "cars".
detach_ducklake("colcomment_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)
