1

I created a MonetDBLite database yesterday, populated it, and was accessing it with dplyr, however this morning I don't seem able to use dplyr.

Here's my connection:

statcast_db <- MonetDBLite::src_monetdblite("/Users/williampetti/statcast_database/statcast_db_Monet", create = FALSE)

And here's a simple query for the statcast_17 table:

statcast_db %>% 
    tbl("statcast_17") %>% 
    select(game_date) %>% 
    distinct() %>% 
    collect() %>% 
    tail(n = 1)

Yesterday, this worked fine. This morning, I get this error:

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

If I use a simple dbGetQuery call, however, it works fine:

> dbGetQuery(statcast_db$con, "SELECT game_date FROM statcast_17 ORDER BY game_date DESC LIMIT 1")
   game_date
1 2017-04-29

Here's my session info:

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] xml2_1.1.1        baseballr_0.3.1   RSQLite_1.0.0     pacman_0.4.1     
 [5] dplyr_0.5.0       purrr_0.2.2       readr_1.0.0       tidyr_0.6.0      
 [9] tibble_1.2        ggplot2_2.2.1     tidyverse_1.0.0   magrittr_1.5     
[13] MonetDBLite_0.3.1 RMySQL_0.10.9     DBI_0.5-1        

loaded via a namespace (and not attached):
 [1] splines_3.3.1       lattice_0.20-33     colorspace_1.2-6   
 [4] htmltools_0.3.5     mgcv_1.8-12         chron_2.3-47       
 [7] XML_3.98-1.6        survival_2.40-1     hexbin_1.27.1      
[10] foreign_0.8-66      RColorBrewer_1.1-2  plyr_1.8.4         
[13] stringr_1.2.0       munsell_0.4.3       gtable_0.2.0       
[16] rvest_0.3.2         XML2R_0.0.6         codetools_0.2-14   
[19] latticeExtra_0.6-28 knitr_1.14          reldist_1.6-6      
[22] htmlTable_1.7       Rcpp_0.12.9         acepack_1.4.1      
[25] scales_0.4.1        pitchRx_1.8.2       Hmisc_4.0-0        
[28] gridExtra_2.2.1     digest_0.6.11       stringi_1.1.3      
[31] grid_3.3.1          tools_3.3.1         bitops_1.0-6       
[34] lazyeval_0.2.0      RCurl_1.95-4.8      Formula_1.2-1      
[37] cluster_2.0.4       MASS_7.3-45         Matrix_1.2-6       
[40] data.table_1.9.6    lubridate_1.6.0     httr_1.2.1         
[43] assertthat_0.1      R6_2.1.3            rpart_4.1-10       
[46] nnet_7.3-12         nlme_3.1-128   
BillPetti
  • 511
  • 2
  • 7
  • 14

1 Answers1

0

I just replied to a similar question this morning after figuring out that the order in which you load MonetDBLite matters. I came across this question trying to figure out why it does matter. I was having the same type of Error in UseMethod problems as BillPetti. Making sure MonetDBLite loads after dplyr and dbplyr has resolved the issue for me. Here's the link to that other answer:

https://stackoverflow.com/a/53307673/3705612

Corey N.
  • 159
  • 11
  • Just wanted to acknowledge that I hadn't seen @BillPetti's last comment (dated 6-Apr-2018) when offering my answer. And now I'm wondering if it's really the order of package loading that is causing the error or whether instead if it's the pre-existing "src_monetdb" object in the workspace when starting the R session. With a clean workspace I can load MonetDBLite before `dplyr` and `dbplyr` and have it work. – Corey N. Nov 14 '18 at 22:21