add_pgcomments: Write Postgres Comments for a Table

View source: R/add_pgcomments.R

add_pgcommentsR Documentation

Write Postgres Comments for a Table

Description

This function allows a user connected to a Postgres database to easily add comments for a single table or the table's fields.

Usage

add_pgcomments(conn, schema = "public", tbl_name = NULL,
  tbl.comments = NULL, field.comments = NULL, verbose = TRUE,
  overwrite = FALSE)

Arguments

conn

a object inheriting from DBIDriver or DBIConnection.

schema

an optional argument to specify the desired database schema location, default is public

tbl_name

a required option if nchar_df argument is a single data.frame

tbl.comments

an optional argument to include a comment for the table being written, if a list it must be named

field.comments

an optional argument to include comments for each field type within the table being written , if a list it must be named

verbose

a logical argument whether to display messages on comment writing steps

overwrite

a logical argument whether to override the writing of pre-existing comments

Value

add_pgcomments() returns TRUE invisibly.

Examples

## Not run: 
nchar_df <- get_nchar(iris)

myconn <- DBI::dbConnect(RSQL::SQLite(), ":memory:")

my_fields <- set_pgfields(iris,
default = FALSE,
conn = myconn)

write_pgtable(input = iris,
field.types = my_fields,
conn = myconn,
tbl_name = "iris")

add_pgcomments(conn = myconn,
tbl_name = "iris",
tbl.comments = "this is the iris dataset!",
overwrite = TRUE)

## End(Not run)


eugejoh/pgtools documentation built on Dec. 11, 2022, 4:29 p.m.