From 3563fa7b57d71d377005137d83ac166eac14f073 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 11 Jan 2024 07:08:54 -0600 Subject: [PATCH] Support non-temporary writes for databricks Fixes #1418 --- NEWS.md | 2 ++ R/backend-spark-sql.R | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index c5a3c5fc5..48eef856a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # dbplyr (development version) +* The databricks backend now supports creating non-temporary tables too (#1418). + * Namespaced dplyr calls now error if the function doesn't exist, or a translation is not available (#1426). diff --git a/R/backend-spark-sql.R b/R/backend-spark-sql.R index 5b43651b5..2893da6a6 100644 --- a/R/backend-spark-sql.R +++ b/R/backend-spark-sql.R @@ -126,12 +126,12 @@ simulate_spark_sql <- function() simulate_dbi("Spark SQL") analyze = TRUE, in_transaction = FALSE) { - if (!temporary) { - cli::cli_abort("Spark SQL only support temporary tables") + if (temporary) { + sql <- sql_values_subquery(con, values, types = types, lvl = 1) + db_compute(con, table, sql, overwrite = overwrite) + } else { + NextMethod() } - - sql <- sql_values_subquery(con, values, types = types, lvl = 1) - db_compute(con, table, sql, overwrite = overwrite) } #' @export