diff --git a/NEWS.md b/NEWS.md index 5ec8e833..f9e92c07 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # bigrquery (development version) +* `con |> tbl(sql("..."))` now works robustly once more (#540). (No more + "URL using bad/illegal format or missing URL" error). + * Align Google APIs URLs to Google Cloud Discovery docs. This enables support for Private and Restricted Google APIs configurations. (@husseyd, #541) - `R/bq-request.R` diff --git a/R/dplyr.R b/R/dplyr.R index 81818446..9a046e97 100644 --- a/R/dplyr.R +++ b/R/dplyr.R @@ -153,6 +153,7 @@ op_can_download.lazy_base_query <- function(x) dbplyr::is.ident(x$x) query_is_head_only <- function(x) { if (!inherits(x$x, "lazy_base_remote_query")) return(FALSE) + if (inherits(x$x$x, "sql")) return(FALSE) vars_base <- dbplyr::op_vars(x$x) if (!is_select_trivial(x$select, vars_base)) return(FALSE) diff --git a/tests/testthat/test-dplyr.R b/tests/testthat/test-dplyr.R index b3a1ae3d..1dbaf9f2 100644 --- a/tests/testthat/test-dplyr.R +++ b/tests/testthat/test-dplyr.R @@ -99,6 +99,10 @@ test_that("collect can identify directly download tables", { x <- dplyr::collect(bq1) expect_s3_class(x, "tbl") + + bq5 <- dplyr::tbl(con, dplyr::sql("SELECT * FROM mtcars")) + expect_false(op_can_download(bq5)) + expect_false(op_can_download(head(bq5))) }) test_that("casting uses bigquery types", {