You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a cross post from over in the Studio Community because I was not sure where to park this comment/issue.
So I got bit by a breaking change in dbplyr. In 1.4.0 there was a breaking change that impacts where eval happens in dbplyr (local vs on the server).
This code used to work in 1.3 but now breaks:
library(tidyverse)
#> Registered S3 methods overwritten by 'ggplot2':
#> method from
#> [.quosures rlang
#> c.quosures rlang
#> print.quosures rlang
testfun <- function(tab, tst_input){
en_tst <- dplyr::enquo(tst_input)
tab %>%
filter(!!en_tst > 15) -> out
return(out)
}
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
mtcars2 <- tbl(con, "mtcars")
testfun(tab = mtcars2, tst_input = mpg)
#> Error in call[[1]]: object of type 'symbol' is not subsettable
but that's easy enough to fix by replacing filter(!!en_tst > 15)
with
filter(local(!!en_tst) > 15)
Not a huge deal, but it was really tricky for me to debug. And while I'm not super well versed in tidy development, I'm typically reasonably competent. So I was a little surprised how hard this was to figure out.
In the release notes there's mention of changes that break subsetting:
Subsetting ( [[ , $ , and [ ) functions are no longer evaluated locally.
So what changed that makes using !! in dbplyr problematic? Is it the subsetting change mentioned above or is it something else altogether?
FWIW, after the change I mention above, the code works great like this:
This is a cross post from over in the Studio Community because I was not sure where to park this comment/issue.
So I got bit by a breaking change in dbplyr. In 1.4.0 there was a breaking change that impacts where eval happens in dbplyr (local vs on the server).
This code used to work in 1.3 but now breaks:
but that's easy enough to fix by replacing
filter(!!en_tst > 15)
with
filter(local(!!en_tst) > 15)
Not a huge deal, but it was really tricky for me to debug. And while I'm not super well versed in tidy development, I'm typically reasonably competent. So I was a little surprised how hard this was to figure out.
In the release notes there's mention of changes that break subsetting:
So what changed that makes using !! in dbplyr problematic? Is it the subsetting change mentioned above or is it something else altogether?
FWIW, after the change I mention above, the code works great like this:
The text was updated successfully, but these errors were encountered: