defer_db_cleanup {SCDB}R Documentation

Delete table at function exit

Description

This function marks a table for deletion once the current function exits.

Usage

defer_db_cleanup(db_table)

Arguments

db_table

(tbl_sql)
A unmanipulated reference to a sql table.

Value

NULL (called for side effects)

Examples


  conn <- get_connection()

  mt <- dplyr::copy_to(conn, mtcars)
  id_mt <- id(mt)

  defer_db_cleanup(mt)

  DBI::dbExistsTable(conn, id_mt) # TRUE

  withr::deferred_run()

  DBI::dbExistsTable(conn, id_mt) # FALSE

  close_connection(conn)


[Package SCDB version 0.4.0 Index]