Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Pool> uses an old dbplyr interface warning (and e.g. error when using stringr) #132

Closed
giocomai opened this issue Jun 6, 2022 · 8 comments · Fixed by #152
Closed

<Pool> uses an old dbplyr interface warning (and e.g. error when using stringr) #132

giocomai opened this issue Jun 6, 2022 · 8 comments · Fixed by #152
Labels
feature a feature request or enhancement

Comments

@giocomai
Copy link

giocomai commented Jun 6, 2022

Due, I believe, to dbplyr latest update on CRAN I am receiving a warning and errors in my scripts (as well as in a CRAN package I maintain) that relies on pool.

The warning seems to appear even with common filters. The error appears in filters that used to work fine until the dbplyr update, but that perhaps did not have a fully compliant syntax to begin with.

Reprex below should show the issue. Latest version on CRAN and current development version from the repository show the same behaviour.

library("dplyr", warn.conflicts = FALSE)

months_df <- tibble::tibble(abb = head(month.abb),
                          name = head(month.name))

months_df
#> # A tibble: 6 × 2
#>   abb   name    
#>   <chr> <chr>   
#> 1 Jan   January 
#> 2 Feb   February
#> 3 Mar   March   
#> 4 Apr   April   
#> 5 May   May     
#> 6 Jun   June

db <- pool::dbPool(
  drv = RSQLite::SQLite(),
  dbname = paste0(tempfile(), "sqlite")
)

pool::dbWriteTable(db,
                   name = "months",
                   value = months_df,
                   append = TRUE
)

pool::dbReadTable(conn = db,
                  name = "months")
#>   abb     name
#> 1 Jan  January
#> 2 Feb February
#> 3 Mar    March
#> 4 Apr    April
#> 5 May      May
#> 6 Jun     June

# just a warning
dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb == "Apr")
#> Warning: <Pool> uses an old dbplyr interface
#> ℹ Please install a newer version of the package or contact the maintainer
#> This warning is displayed once every 8 hours.
#> # Source:   SQL [1 x 2]
#> # Database: sqlite 3.38.5 [/tmp/Rtmp3yO10e/filea7e172c2d5eesqlite]
#>   abb   name 
#>   <chr> <chr>
#> 1 Apr   April

dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb %in% c("Feb", "Apr"))
#> # Source:   SQL [2 x 2]
#> # Database: sqlite 3.38.5 [/tmp/Rtmp3yO10e/filea7e172c2d5eesqlite]
#>   abb   name    
#>   <chr> <chr>   
#> 1 Feb   February
#> 2 Apr   April


## error
dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb %in% stringr::str_to_title(c("feb", "apr")))
#> Error: no such table: INITCAP

dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb %in% stringr::str_to_upper(c("feb", "apr")))
#> Error: no such table: UPPER

dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb %in% stringr::str_c(c("Feb", "Apr")))
#> Error: no such table: CONCAT_WS

## but can prevent with !!

dplyr::tbl(src = db, "months") %>%
  dplyr::filter(.data$abb %in% !!stringr::str_to_title(c("feb", "apr")))
#> # Source:   SQL [2 x 2]
#> # Database: sqlite 3.38.5 [/tmp/Rtmp3yO10e/filea7e172c2d5eesqlite]
#>   abb   name    
#>   <chr> <chr>   
#> 1 Feb   February
#> 2 Apr   April

Created on 2022-06-06 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.3 (2022-03-10)
#>  os       Fedora Linux 35 (Workstation Edition)
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_IE.UTF-8
#>  ctype    en_IE.UTF-8
#>  tz       Europe/Vienna
#>  date     2022-06-06
#>  pandoc   2.14.0.3 @ /usr/libexec/rstudio/bin/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.1.2)
#>  bit           4.0.4      2020-08-04 [1] CRAN (R 4.1.1)
#>  bit64         4.0.5      2020-08-30 [1] CRAN (R 4.1.1)
#>  blob          1.2.3      2022-04-10 [1] CRAN (R 4.1.3)
#>  cachem        1.0.6      2021-08-19 [1] CRAN (R 4.1.1)
#>  cli           3.3.0      2022-04-25 [1] CRAN (R 4.1.3)
#>  crayon        1.5.1      2022-03-26 [1] CRAN (R 4.1.2)
#>  DBI           1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
#>  dbplyr        2.2.0      2022-06-05 [1] CRAN (R 4.1.3)
#>  digest        0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
#>  dplyr       * 1.0.9      2022-04-28 [1] CRAN (R 4.1.3)
#>  ellipsis      0.3.2      2021-04-29 [2] CRAN (R 4.1.0)
#>  evaluate      0.15       2022-02-18 [1] CRAN (R 4.1.2)
#>  fansi         1.0.3      2022-03-24 [1] CRAN (R 4.1.2)
#>  fastmap       1.1.0      2021-01-25 [2] CRAN (R 4.1.0)
#>  fs            1.5.2.9000 2022-05-31 [1] Github (r-lib/fs@e7d98c4)
#>  generics      0.1.2      2022-01-31 [1] CRAN (R 4.1.2)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.1.2)
#>  highr         0.9        2021-04-16 [3] CRAN (R 4.1.0)
#>  htmltools     0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  knitr         1.39       2022-04-26 [1] CRAN (R 4.1.3)
#>  later         1.3.0      2021-08-18 [1] CRAN (R 4.1.2)
#>  lifecycle     1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.1.3)
#>  memoise       2.0.1      2021-11-26 [1] CRAN (R 4.1.2)
#>  pillar        1.7.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
#>  pool          0.1.6      2021-01-14 [1] CRAN (R 4.1.2)
#>  purrr         0.3.4      2020-04-17 [1] CRAN (R 4.1.2)
#>  R.cache       0.15.0     2021-04-30 [3] CRAN (R 4.1.0)
#>  R.methodsS3   1.8.1      2020-08-26 [3] CRAN (R 4.1.0)
#>  R.oo          1.24.0     2020-08-26 [3] CRAN (R 4.1.0)
#>  R.utils       2.11.0     2021-09-26 [1] CRAN (R 4.1.2)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  Rcpp          1.0.8.3    2022-03-17 [1] CRAN (R 4.1.2)
#>  reprex        2.0.1      2021-08-05 [1] CRAN (R 4.1.1)
#>  rlang         1.0.2      2022-03-04 [1] CRAN (R 4.1.2)
#>  rmarkdown     2.14       2022-04-25 [1] CRAN (R 4.1.3)
#>  RSQLite       2.2.14     2022-05-07 [1] CRAN (R 4.1.3)
#>  rstudioapi    0.13       2020-11-12 [1] CRAN (R 4.1.2)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi       1.7.6      2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 4.1.2)
#>  styler        1.7.0      2022-03-13 [1] CRAN (R 4.1.2)
#>  tibble        3.1.7      2022-05-03 [1] CRAN (R 4.1.3)
#>  tidyselect    1.1.2      2022-02-21 [1] CRAN (R 4.1.2)
#>  utf8          1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
#>  vctrs         0.4.1      2022-04-13 [1] CRAN (R 4.1.3)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.1.2)
#>  xfun          0.31       2022-05-10 [1] CRAN (R 4.1.3)
#>  yaml          2.3.5      2022-02-21 [1] CRAN (R 4.1.2)
#> 
#>  [1] /home/g/R/x86_64-redhat-linux-gnu-library/4.1
#>  [2] /usr/lib64/R/library
#>  [3] /usr/share/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@giocomai
Copy link
Author

giocomai commented Jun 6, 2022

I see in the dbplyr news accompanying the latest release:

Calls of the form stringr::foo() or lubridate::foo() are now evaluated in the database, rather than locally (#197).

Which I suspect is what is indirectly causing the stringr-related issues reported above.

@jjfantini
Copy link

I am getting this error as well. All i did to generate this error was the following:


pool <- pool::dbPool(RPostgres::Postgres(),
                             host   = *address*,
                             dbname = *db_name*,
                             user      = *user*,
                             password  = *pass*,
                             port     = xxxxx)

dplyr::tbl(pool, "table_name")

Warning message:
<Pool> uses an old dbplyr interface
ℹ Please install a newer version of the package or contact the maintainer
This warning is displayed once every 8 hours. 

@jjfantini

This comment was marked as off-topic.

@hadley

This comment was marked as off-topic.

@giocomai

This comment was marked as off-topic.

@hadley

This comment was marked as off-topic.

@nick-youngblut
Copy link

I'm also getting the warning:

Warning: <Pool> uses an old dbplyr interface
ℹ Please install a newer version of the package or contact the maintainer
This warning is displayed once every 8 hours.

Any updates on this? Should one be concerned about this warning when using RPostgres + pool + dbplyr?

@hadley
Copy link
Member

hadley commented Jan 9, 2023

You don't need to concerned about the warning, and it's fixed in #152. Hopefully we can get a pool release out in the next week or so.

@hadley hadley closed this as completed Jan 9, 2023
@hadley hadley reopened this Jan 9, 2023
hadley added a commit that referenced this issue Jan 28, 2023
Now replaces minimal set of methods with automatically generated wrappers.

Fixes #132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants