#' @export
is_driver.DBIDriver <- function(x, ...) TRUE
#' @export
connect.DBIDriver <- function(x, ...) {
args <- rlang::dots_list(..., .homonyms = "last")
rlang::exec(DBI::dbConnect, drv = x, !!!args)
}
#' @export
disconnect.DBIConnection <- function(x, ...) {
DBI::dbDisconnect(x, ...)
}
#' @export
is_connected.DBIConnection <- function(x, ...) {
DBI::dbIsValid(x, ...)
}
#' @export
list_datasets.DBIConnection <- function(x, ...) {
DBI::dbListTables(x, ...)
}
#' @export
read_dataset.DBIConnection <- function(x, name, ..., lazy = FALSE) {
out <- dplyr::tbl(x, name)
if (lazy) {
return(out)
}
dplyr::collect(out)
}
#' @export
write_dataset.DBIConnection <- function(x, name, data, ..., temporary = FALSE) {
dplyr::copy_to(dest = x, name = name, df = data, temporary = temporary, ...)
}
#' @export
remove_dataset.DBIConnection <- function(x, name, ...) {
DBI::dbRemoveTable(x, name, ...)
}
#' @export
exists_dataset.DBIConnection <- function(x, name, ...) {
DBI::dbExistsTable(x, name, ...)
}
#' @export
list_fields.DBIConnection <- function(x, name, ...) {
DBI::dbListFields(x, name, ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.