0

This is a follow-up to a previously asked question: Copy a list of data.frame(s) to sqlite database using dplyr. Now I want to load data.frames to an sqlite database using dplyr but some of the data.frames have dots in the name. For example,

data(iris)
data(cars)

res <- list("ir.is" = iris, "cars" = cars)

my_db <- dplyr::src_sqlite(paste0(tempdir(), "/foobar.sqlite3"),
                       create = TRUE)

lapply(seq_along(res), function(i, dt = res) dplyr::copy_to(my_db,
 dt[[i]], names(dt)[[i]]))

Error in sqliteSendQuery(conn, statement, bind.data) : error in statement: near "is": syntax error

I think the error is due to lack of quoting in the underlying internal SQL statements.

Community
  • 1
  • 1
jsta
  • 3,216
  • 25
  • 35
  • 1
    Please see this answer: [Bracket escape table names with dplyr](http://stackoverflow.com/questions/28132697/bracket-escaped-table-names-with-dplyr). – Michael Griffiths Oct 10 '16 at 22:40
  • The solution is to upgrade to the Github version of `DBI` and `RSQLite`. – jsta Oct 10 '16 at 22:43

0 Answers0