Hi,
I recently updated dplyr, and it seems to have broken my code for accessing a database that I have on my local disk.
Trying to connect to the database with:
my_db <- src_sqlite("my_database.db")
Gives the error message: "Error: Condition message must be a string."
I can connect fine using DBI via the command:
con <- DBI::dbConnect(RSQLite::SQLite(), "my_database.db")
This suggests my database is still accessible and working fine. In light of the documentation for the new dbplyr package, I thought that maybe I could access the tables using
tbl(con, "name_of_table")
But this does not work, even though the tables all appear fine when I type dbListTables(con). I get the same error message, "Error: Condition message must be a string."
Any ideas?
Thanks!
Same issue here. Temporary fix on my end has been SQL via:
tbl(con, sql('select * from my_database.db'))
Possibly worth noting DBI, RJDBC, and RODBC all connect fine as well.
Hi,
I'm not sure of the answers, but, just to help us isolate the problem, what versions did you update from/to? I don't think it's necessarily related, but #3164 is the most recent change I can find related to src_sqlite().
Hi,
I currently have dplyr_0.7.4, and I upgraded from dplyr_0.5.0. I wondered if this has something to do with the recent changes to database backends (https://github.com/tidyverse/dplyr/blob/master/NEWS.md), but apparently src_sqlite is supposed to still be working ok.
Thanks!
I seem to have solved the issue by running install.packages("dbplyr"). Maybe it's worth making this package a dependency of dplyr? src_sqlite() is apparently still a dplyr function (you can see this with ?src_sqlite), but it seems to only work if dbplyr is also installed (you don't need to run library(dbplyr) though).
I had dbplyr and all necessary packages installed when experiencing the issues, but it made no difference from my previous comment. I'm not sure that it makes a difference, but I am using src_postgres(), not scr_sqlite().
I think I ran into the same issue. Running testthat tests of a function that accesses SQLite database work locally when I use "Test package" in RStudio. But fail with the following when tests are run via "Check package" in RStudio or by TravisCI:
checking tests ... ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
14: tbl.DBIConnection(., "Codings")
15: check_dbplyr()
16: check_pkg("dbplyr", "communicate with database backends", install = FALSE)
17: glubort(NULL, "The {name} package is required to {reason}.", if (install) "\nPlease install it with `install.packages(\"{name}\")`")
18: .abort(text)
19: cnd_error(type, .msg = msg, .call = sys.call(-1))
20: new_cnd(c(.type, "error"), ..., .msg = .msg)
21: stop("Condition message must be a string", call. = FALSE)
See also https://travis-ci.org/mbojan/maxqdar/builds/310860713
Session info ------------------------------------------------------------------------------------------------------
setting value
version R version 3.4.3 (2017-11-30)
system x86_64, mingw32
ui RStudio (1.1.383)
language (EN)
collate Polish_Poland.1250
tz Europe/Warsaw
date 2017-12-03
Packages ----------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.1)
base * 3.4.3 2017-11-30 local
bindr 0.1 2016-11-13 CRAN (R 3.4.1)
bindrcpp 0.2 2017-06-17 CRAN (R 3.4.1)
bit 1.1-12 2014-04-09 CRAN (R 3.4.1)
bit64 0.9-7 2017-05-08 CRAN (R 3.4.1)
blob 1.1.0 2017-06-17 CRAN (R 3.4.1)
commonmark 1.4 2017-09-01 CRAN (R 3.4.1)
compiler 3.4.3 2017-11-30 local
crayon 1.3.4 2017-12-03 Github (r-lib/crayon@b5221ab)
datasets * 3.4.3 2017-11-30 local
DBI 0.7 2017-06-18 CRAN (R 3.4.1)
dbplyr 1.1.0.9000 2017-12-03 Github (hadley/dbplyr@a424f67)
devtools 1.13.4 2017-11-09 CRAN (R 3.4.2)
digest 0.6.12 2017-01-27 CRAN (R 3.4.1)
dplyr 0.7.4.9000 2017-12-03 Github (hadley/dplyr@fc66342)
glue 1.2.0 2017-10-29 CRAN (R 3.4.2)
graphics * 3.4.3 2017-11-30 local
grDevices * 3.4.3 2017-11-30 local
magrittr 1.5 2014-11-22 CRAN (R 3.4.1)
maxqdar * 0.0.1 <NA> local
memoise 1.1.0 2017-04-21 CRAN (R 3.4.1)
methods * 3.4.3 2017-11-30 local
pillar 0.0.0.9000 2017-12-03 Github (r-lib/pillar@5a082e1)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.1)
purrr 0.2.4 2017-10-18 CRAN (R 3.4.2)
R6 2.2.2 2017-06-17 CRAN (R 3.4.1)
Rcpp 0.12.14 2017-11-23 CRAN (R 3.4.3)
rlang 0.1.4 2017-11-05 CRAN (R 3.4.2)
roxygen2 6.0.1 2017-02-06 CRAN (R 3.4.1)
RSQLite 2.0 2017-06-19 CRAN (R 3.4.1)
rstudioapi 0.7 2017-09-07 CRAN (R 3.4.1)
stats * 3.4.3 2017-11-30 local
stringi 1.1.6 2017-11-17 CRAN (R 3.4.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.1)
testthat * 1.0.2 2016-04-23 CRAN (R 3.4.3)
tibble 1.3.4.9003 2017-12-03 Github (tidyverse/tibble@60281b3)
tidyselect 0.2.3 2017-11-06 CRAN (R 3.4.2)
tools 3.4.3 2017-11-30 local
utils * 3.4.3 2017-11-30 local
withr 2.1.0 2017-11-01 CRAN (R 3.4.2)
xml2 1.1.1 2017-01-24 CRAN (R 3.4.1)
yaml 2.1.15 2017-12-01 CRAN (R 3.4.2)
Thanks. As noted before, you now need the dbplyr package to access database backends. We cannot make dbplyr a dependency of dplyr, because dbplyr imports and overrides functions and methods from dplyr.
The error message looks strange because of this:
dput(glue::glue("abc", NULL))
#> structure(character(0), class = c("glue", "character"))
@jimhester: Has the behavior of glue(..., NULL) changed recently?
No this is not new behavior and this is the expected behavior https://github.com/tidyverse/glue/blame/master/tests/testthat/test-glue.R#L184-L191
This error message is really confusing. If not for this thread, I would have never linked it to the missing dependency.
Most helpful comment
This error message is really confusing. If not for this thread, I would have never linked it to the missing dependency.