#' @title
#' Clone a database connection
#'
#' @description
#' In order to support an interactive querying environment with modifications
#' and not veer away from R's copy-on-modify semantics, we'd need to "branch"
#' out database connections so that any DML and DDL statement does not affect
#' the global state. Cloning database connections are needed to do this.
#'
#' @param conn (DBIConnection) object
#'
#' @family Extra DBI Methods
#' @export
dbClone <- function(conn) {
UseMethod("dbClone")
}
#' @export
dbClone.PqConnection <- function(conn) {
assert_true(is_native(conn))
exec(connect, adapter = "postgres", !!!attr(conn, "args"))
}
#' @export
dbClone.default <- function(conn) {
dbConnect(conn)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.