If you are seeing this error in code that used to work, the most likely cause is a change dbplyr 1.4.0.

Hi.

A quick question. I have updated shiny app from 3.5.1 to 3.6.1 with all the packages. The code now breaks becuase of new version of dplyr/dbplyr with fairly self-explanatory error message If you are seeing this error in code that used to work, the most likely cause is a change dbplyr 1.4.0. Previously df$xordf[[y]]implied thatdfwas a local variable, but now you must make that explict with!!orlocal(), e.g., !!df$x or local(df[["y"])) .
Quick googling shows that it affects %in% function. Are there other functions where I could expect problems?

Is there a way to check where exactly it breaks?
Thanks!

What does change is code like that:

some_vector <- list(some_values = c("value_1", "value_2"))
df %>%
  dplyr::filter(x %in% some_vector$some_values)

If your df is a remote database connection, then dbplyr will assume that some_vector is a column in your remote dataset and will try to look for some_values in it. To avoid that, you'll want to do something like what is suggested in the error message:

some_vector <- list(some_values = c("value_1", "value_2"))
df %>%
  dplyr::filter(x %in% !!some_vector$some_values)

# or

some_vector <- list(some_values = c("value_1", "value_2"))
df %>%
  dplyr::filter(x %in% local(some_vector$some_values))

The reason this is happening is because most modern DB's have some support for json and now some_vector$some_values can be used to extract some_values element from some_vector in your DB. Therefore, you need to explicitly tell dbplyr where to look for some_vector$some_values

2 Likes

Thanks Misha. I will consider rollback of dbplyr, cause it keeps jumping at me even though it should not at the first glance. The app reactivity inheritance between modules is fairly complex.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.