0
votes

I try to run a simple dplyr command, on an monetdb SQL-backend. The connection itself seems to work, but the dplyr call fails. I restarted the RSession and tried to reinstall the MonetDB.R package again, without success.

library(dplyr)
db <- MonetDB.R::src_monetdb("ai_db", user="analyst", host="monetdb.local", password="mypassword")

## works!
DBI::dbGetQuery(db$con, "SELECT count(*) from users")

## fails
db %>% tbl("users") %>% mutate(n= n())

Source: query [?? x 7] Database: MonetDB 11.25.5 (Dec2016-SP1)

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

I installed dplyr using the default repository/settings (packages.install("dplyr")) in a docker container (rocker/verse:3.3.2).

UPDATE 1: MonetDBLite instead od MonetDB.R

Now I installed MonetDBLite and I use the following code to create a connection:

con <- mc(dbname="ai_db", user="analyst", password="mypassword", host="monetdb.local",
          timeout=86400000)
db <- MonetDBLite::src_monetdb("ai_db",con=con)

I set a quite high timeout, because of a error message indicating a to low one (see below). However, the command fails again and I don't think that it is related to the timeout, because it fails immediately.

## fails
db %>% tbl("users") %>% mutate(n= n())

Source: query [?? x 7] Database: MonetDB 11.25.5 (Dec2016-SP1)

Error in .mapiRead(conObj@connenv$socket) : Empty response from MonetDB server, probably a timeout. You can increase the time to wait for responses with the 'timeout' parameter to 'dbConnect()'.

The dataset is really small (just 5000 entries) so this should not be a big deal. MonetDB is installed ont he same server and works great, also the DBI interface works (and returns the result within a second):

DBI::dbGetQuery(con, "SELECT count(*) from videos")

UPDATE 2:

Now I tried both, the dev-version of MonetdbLite and the stable CRAN-version from the repository. Both fail, but with different errors.

packages.install("MonetDBLite")
db <- MonetDBLite::src_monetdb("ai_db", user="analyst", password="mypassword", host="monetdb.local")
db %>% tbl("users") %>% mutate(n= n())

Source: query [?? x 7] Database: MonetDB 11.25.5 (Dec2016-SP1)

Error in .mapiRead(conObj@connenv$socket) : Empty response from MonetDB server, probably a timeout. You can increase the time to wait for responses with the 'timeout' parameter to 'dbConnect()'.

devtools::install_github( "hannesmuehleisen/MonetDBLite" )
db <- MonetDBLite::src_monetdb("ai_db", user="analyst", password="mypassword", host="monetdb.local")
db %>% tbl("users") %>% mutate(n= n())

Source: query [?? x 7] Error in inherits(con_acquire(x), "MonetDBEmbeddedConnection") : could not find function "con_acquire"

1
passing test cases: github.com/hannesmuehleisen/MonetDBLite/blob/master/tests/… you might need devtools::install_github( "hannesmuehleisen/MonetDBLite" ) not sure - Anthony Damico
@AnthonyDamico I tried src_monetdb("ai_db", user="analyst", password="mypassword", host="monetdb.local") first, but then I had to rewrite it to set the timeout (I always got this annoying timeout error). I will try to install the dev-version within the next days, but I hope that I get the stable CRAN version to work (I am using a pre-build docker image and I would prefer a solution without the need to install all the monetdb dependencies (e.g., libmonetdb5.so)). - NaN
@AnthonyDamico ok, it was not a dependency problem, I just had to set the permissions correctly and then I was able install the package using devtools. The newest version also fails, but with a different error (I updated my post already). - NaN
Do you mean the ajdamico/lodown library? should this fix the missing con_acquire function or the CRAN monetDBLite version? I installed it and tried the MonetdbLite devtools installation again, but I still get the same error (could not find function "con_acquire") - NaN

1 Answers

1
votes

Please use the MonetDBLite package instead, it contains the code to connect to standalone servers, too