View source: R/cdr_trunc_tbl.R
cdr_trunc_tbl | R Documentation |
Removes a specified table by deleting the table or by removing just the table data (truncating)
cdr_trunc_tbl(
conn_pool,
db_tbl_name = NULL,
removal = c("truncate", "delete"),
...
)
conn_pool |
pool connection object: the pool of connections established by the session |
db_tbl_name |
string: name of the specific table, or cdr_id() object |
removal |
string: one of 'truncate' or 'delete' |
... |
other args specifying a DB table such as |
TRUE for success; FALSE for removal fail
## Not run:
con <- pool::dbPool(DBI::dbConnect(RSQLite::SQLite(), 'test.db'))
example_tbl <- dplyr::mutate(iris, bool = Species == 'setosa', day = Sys.Date(), test = Sys.time())
cdr_make_db_tbls(con, example_tbl, chg_log_suffix = '_deltas')
con |> DBI::dbListTables()
cdr_trunc_tbl(conn_pool = con, db_tbl_name = 'example_tbl', removal = 'truncate')
con |> DBI::dbListTables()
DBI::dbListTables(con) |> purrr::map(\(.) cdr_trunc_tbl(con, ., 'delete'))
con |> DBI::dbListTables()
pool::poolClose(con)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.