Skip to content

Commit 389cfc9

Browse files
committed
documentation and bugfix
1 parent 11ac71d commit 389cfc9

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

R/dbSource.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,16 @@ insertTable.db_cdm <- function(cdm,
8282
return(x)
8383
}
8484

85-
#' @export
85+
#' Drop table from a database backed cdm object
86+
#'
87+
#' Tables will be dropped from the write schema of the cdm.
88+
#'
89+
#' @param cdm a cdm_reference object
90+
#' @param name A character vector of table names to be dropped
91+
#'
92+
#' @importFrom omopgenerics dropTable
8693
#' @importFrom tidyselect starts_with ends_with matches
94+
#' @export
8795
dropTable.db_cdm <- function(cdm, name) {
8896
# initial checks
8997
schema <- attr(cdm, "write_schema")
@@ -309,7 +317,7 @@ insertCdmTo.db_cdm <- function(cdm, to) {
309317
}
310318
insertTable(cdm = to, name = nm, table = x, overwrite = TRUE)
311319
if ("cohort_table" %in% cl) {
312-
cohorts <- c(cohort, nm)
320+
cohorts <- c(cohorts, nm)
313321
insertTable(cdm = to, name = paste0(nm, "_set"), table = attr(x, "cohort_set"), overwrite = TRUE)
314322
insertTable(cdm = to, name = paste0(nm, "_attrition"), table = attr(x, "cohort_attrition"), overwrite = TRUE)
315323
insertTable(cdm = to, name = paste0(nm, "_codelist"), table = attr(x, "cohort_codelist"), overwrite = TRUE)
@@ -341,6 +349,7 @@ insertCdmTo.db_cdm <- function(cdm, to) {
341349
#'
342350
#' @param cdm cdm reference
343351
#' @param dropWriteSchema Whether to drop tables in the writeSchema
352+
#' @param ... Not used
344353
#'
345354
#' @export
346355
cdmDisconnect.db_cdm <- function(cdm, dropWriteSchema = FALSE, ...) {

man/cdmDisconnect.db_cdm.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dropTable.db_cdm.Rd

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-07-db-dateadd.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ test_clock_functions <- function(con, write_schema) {
227227
expect_equal(unique(df$m2), 12)
228228
expect_equal(unique(df$d2), 1)
229229

230-
# if (dbms(con) %in% c("redshift", "postgres")) {
230+
if (dbms(con) %in% c("redshift", "postgres")) {
231231
df$dif_days <- abs(df$dif_days) # TODO on some dbms the translation of difftime does not match base R difftime and we get the wrong sign
232-
# }
232+
}
233233

234234
# some of these translations are failing on certain database platforms
235235
if (!(dbms(con) %in% c("duckdb"))) {

0 commit comments

Comments
 (0)