From c41858adc2591cd44b7b5361b146248f0811306d Mon Sep 17 00:00:00 2001 From: Adam Black Date: Mon, 11 Dec 2023 19:47:59 +0100 Subject: [PATCH] change overwrite default --- R/compute.R | 8 ++++---- tests/testthat/test-db-compute.R | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/compute.R b/R/compute.R index da205b9b..9780a9f0 100644 --- a/R/compute.R +++ b/R/compute.R @@ -11,7 +11,7 @@ # @return A dplyr reference to the newly created table # # internal function -.computePermanent <- function(x, name, schema = NULL, overwrite = FALSE) { +.computePermanent <- function(x, name, schema = NULL, overwrite = TRUE) { checkmate::assertCharacter(schema, min.len = 1, max.len = 2, null.ok = TRUE) schema <- unname(schema) checkmate::assertCharacter(name, len = 1) @@ -154,8 +154,8 @@ unique_table_name <- uniqueTableName #' @param temporary Should the table be temporary: TRUE (default) or FALSE #' @param schema The schema where the table should be created. Ignored if #' temporary = TRUE. -#' @param overwrite Should the table be overwritten if it already exists: TRUE -#' or FALSE (default) Ignored if temporary = TRUE. +#' @param overwrite Should the table be overwritten if it already exists: TRUE (default) +#' or FALSE Ignored if temporary = TRUE. #' @param ... Further arguments passed on the `dplyr::compute` #' #' @return A `dplyr::tbl()` reference to the newly created table. @@ -184,7 +184,7 @@ computeQuery <- function(x, name = uniqueTableName(), temporary = TRUE, schema = NULL, - overwrite = FALSE, + overwrite = TRUE, ...) { if (is.data.frame(x) || (methods::is(x, "Table") && methods::is(x, "ArrowTabular"))) { diff --git a/tests/testthat/test-db-compute.R b/tests/testthat/test-db-compute.R index f66df9f9..a65cbaec 100644 --- a/tests/testthat/test-db-compute.R +++ b/tests/testthat/test-db-compute.R @@ -53,7 +53,7 @@ test_compute_query <- function(con, cdm_schema, write_schema) { expect_error({ cdm$vocabulary %>% dplyr::filter(vocabulary_id %in% c("ATC", "CPT4")) %>% - computeQuery(new_table_name, schema = write_schema, temporary = FALSE)}, + computeQuery(new_table_name, schema = write_schema, temporary = FALSE, overwrite = FALSE)}, "already exists") expect_no_error({