Search code examples
rsqlitedbiduckdb

Pool: Can't open database


I am trying to use pool to connect to my DuckDB/SQLite database .

con <- pool::dbPool(
  drv = duckdb::duckdb(),
  dbname = "data",
  host = "FINAL_data.duckdb")

when I then type

dplyr::tbl(con,"data") 

I can't open the database.

Error in dbplyr::as.sql(from, con) : unused argument (con)

So I try:

dplyr::tbl("data") 

Error in UseMethod("tbl") : 
  no applicable method for 'tbl' applied to an object of class "character"

So I went back to

con <- dbConnect(duckdb::duckdb(), "FINAL_data.duckdb")
bigdf<-tbl(con,"data")

And this won't open the database now at all (which previously worked fine). The DB is still on disk and about 24G in size. Any thoughts as to what's going on are really appreciated!

Error in .local(conn, statement, ...) : 
  duckdb_prepare_R: Failed to prepare query SELECT *
FROM "data" AS "zzz6"
WHERE (0 = 1)
Error: Catalog Error: Table with name data does not exist!
LINE 2: FROM "data" AS "zzz6"

Solution

  • I experienced the same issue and it seems to be an incompatibility between the pool and dbplyr version.

    For version of pool 0.1.5 and up you need to used dbplyr version 2.0.0 and up. If you use lower version of dbplyr e.g. 1.4.4 you need to downgrade your pool to e.g. 0.1.4.3