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

Error in n_distinct(year, na.rm = TRUE) : unused argument (na.rm = TRUE) when using Azure Synapse #1579

Open
SimonCoulombe opened this issue Feb 6, 2025 · 0 comments

Comments

@SimonCoulombe
Copy link

Hi!
Thanks for this amazing package. I'm getting "Error in n_distinct(year, na.rm = TRUE) : unused argument (na.rm = TRUE)" when trying to work on Azure Synapse, but not on DuckDB.

This works :


library(duckdb) # for local database example
library(pool)
library(dplyr) 
library(dbplyr)
library(DBI)
gapdata <- gapminder::gapminder %>%  mutate(date = as.Date(paste0(year, "-01-01"))) %>% filter(year >= 1990) %>% mutate(prout = NA_character_)
# Create a DuckDB connection pool (in-memory database)
pool <- dbPool(
  drv = duckdb::duckdb(),
  dbdir = ":memory:"
)

dbWriteTable(pool, SQL("gapdata"), gapdata)

tbl(pool, "gapdata") %>% 
  summarise(pouet = n_distinct(year, na.rm = TRUE))
# Source:   SQL [?? x 1]
# Database: DuckDB v1.1.3 [unknown@Linux 5.14.0-503.16.1.el9_5.x86_64:R 4.3.0/:memory:]
  pouet
  <dbl>
1     4

This doesnt :


pool2 <- pool::dbPool(drv = odbc::odbc(),
                     driver = "ODBC Driver 18 for SQL Server",
                     uid = Sys.getenv("AZURE_USER"),
                     pwd = Sys.getenv("AZURE_PWD"),
                     database = Sys.getenv("AZURE_DATABASE"),
                     server = Sys.getenv("AZURE_SERVER"),
                     Authentication = "ActiveDirectoryPassword",
                     port = 5480,
                     minSize = 0, ## default is 1 which often leaves connections hanging (not cool)
                     idleTimeout = 600, ## 10 minutes until idle connection is closed, takes ~1 second to reopen
                     encoding = "UTF-8",
                     encrypt = "yes")


tbl(pool2, dbplyr::in_schema("wz_pricing", "gapdata") )%>% 
  summarise(pouet = n_distinct(year, na.rm = TRUE))

Error in n_distinct(year, na.rm = TRUE) : unused argument (na.rm = TRUE)

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21)
 os       Red Hat Enterprise Linux 9.5 (Plow)
 system   x86_64, linux-gnu
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/Toronto
 date     2025-02-06
 rstudio  2024.04.2+764.pro1 Chocolate Cosmos (server)
 pandoc   3.1.11 @ /usr/lib/rstudio-server/bin/quarto/bin/tools/x86_64/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────
 ! package      * version  date (UTC) lib source
 P arrow          18.1.0.1 2025-01-08 [?] RSPM
 P assertthat     0.2.1    2019-03-21 [?] RSPM (R 4.3.0)
 P bit            4.0.5    2022-11-15 [?] RSPM (R 4.3.0)
 P bit64          4.0.5    2020-08-30 [?] RSPM (R 4.3.0)
 P blob           1.2.4    2023-03-17 [?] RSPM (R 4.3.0)
 P cachem         1.1.0    2024-05-16 [?] RSPM (R 4.3.0)
 P cli            3.6.2    2023-12-11 [?] CRAN (R 4.3.0)
 P colorspace     2.1-1    2024-07-26 [?] RSPM (R 4.3.0)
 P crayon         1.5.3    2024-06-20 [?] RSPM (R 4.3.0)
 P data.table     1.16.4   2024-12-06 [?] RSPM (R 4.3.0)
 P DBI          * 1.2.3    2024-06-02 [?] RSPM (R 4.3.0)
 P dbplyr       * 2.5.0    2024-03-19 [?] RSPM (R 4.3.0)
 P devtools       2.4.5    2022-10-11 [?] RSPM
 P digest         0.6.37   2024-08-19 [?] RSPM (R 4.3.0)
 P dplyr        * 1.1.4    2023-11-17 [?] RSPM (R 4.3.0)
 P duckdb       * 1.1.3-2  2025-01-24 [?] RSPM
 P ellipsis       0.3.2    2021-04-29 [?] RSPM (R 4.3.0)
 P evaluate       1.0.3    2025-01-10 [?] RSPM
 P fastmap        1.2.0    2024-05-15 [?] RSPM (R 4.3.0)
 P fs             1.6.5    2024-10-30 [?] RSPM (R 4.3.0)
 P gapminder      1.0.0    2023-03-10 [?] CRAN (R 4.3.0)
 P generics       0.1.3    2022-07-05 [?] RSPM (R 4.3.0)
 P ggplot2        3.5.1    2024-04-23 [?] RSPM (R 4.3.0)
 P glue           1.7.0    2024-01-09 [?] RSPM (R 4.3.0)
 P gtable         0.3.6    2024-10-25 [?] RSPM (R 4.3.0)
 P hms            1.1.3    2023-03-21 [?] RSPM (R 4.3.0)
 P htmltools      0.5.8.1  2024-04-04 [?] RSPM (R 4.3.0)
 P htmlwidgets    1.6.4    2023-12-06 [?] RSPM (R 4.3.0)
 P httpuv         1.6.15   2024-03-26 [?] RSPM (R 4.3.0)
 P knitr          1.49     2024-11-08 [?] RSPM (R 4.3.0)
 P later          1.4.1    2024-11-27 [?] RSPM (R 4.3.0)
 P lifecycle      1.0.4    2023-11-07 [?] RSPM (R 4.3.0)
 P magrittr       2.0.3    2022-03-30 [?] RSPM (R 4.3.0)
 P memoise        2.0.1    2021-11-26 [?] RSPM (R 4.3.0)
 P mime           0.12     2021-09-28 [?] RSPM (R 4.3.0)
 P miniUI         0.1.1.1  2018-05-18 [?] RSPM (R 4.3.0)
 P munsell        0.5.1    2024-04-01 [?] RSPM (R 4.3.0)
 P odbc           1.5.0    2024-06-05 [?] RSPM (R 4.3.0)
 P pillar         1.10.1   2025-01-07 [?] RSPM
 P pkgbuild       1.4.6    2025-01-16 [?] RSPM
 P pkgconfig      2.0.3    2019-09-22 [?] RSPM (R 4.3.0)
 P pkgload        1.4.0    2024-06-28 [?] RSPM (R 4.3.0)
 P pool         * 1.0.4    2024-10-07 [?] RSPM (R 4.3.0)
 P profvis        0.4.0    2024-09-20 [?] RSPM (R 4.3.0)
 P promises       1.3.2    2024-11-28 [?] RSPM (R 4.3.0)
 P purrr          1.0.2    2023-08-10 [?] RSPM (R 4.3.0)
 P R6             2.5.1    2021-08-19 [?] RSPM (R 4.3.0)
 P RColorBrewer   1.1-3    2022-04-03 [?] RSPM (R 4.3.0)
 P Rcpp           1.0.14   2025-01-12 [?] RSPM
 P remotes        2.5.0    2024-03-17 [?] RSPM
   renv           1.0.7    2024-04-11 [1] CRAN (R 4.3.0)
 P rlang          1.1.5    2025-01-17 [?] RSPM
 P rmarkdown      2.29     2024-11-04 [?] RSPM (R 4.3.0)
 P rstudioapi     0.17.1   2024-10-22 [?] RSPM (R 4.3.0)
 P scales         1.3.0    2023-11-28 [?] RSPM (R 4.3.0)
 P sessioninfo    1.2.2    2021-12-06 [?] RSPM
 P shiny          1.10.0   2024-12-14 [?] RSPM
 P stringi        1.8.4    2024-05-06 [?] RSPM (R 4.3.0)
 P stringr        1.5.1    2023-11-14 [?] RSPM (R 4.3.0)
 P tibble         3.2.1    2023-03-20 [?] RSPM (R 4.3.0)
 P tidyselect     1.2.1    2024-03-11 [?] RSPM (R 4.3.0)
 P urlchecker     1.0.1    2021-11-30 [?] RSPM
 P usethis        3.1.0    2024-11-26 [?] RSPM
 P vctrs          0.6.5    2023-12-01 [?] RSPM (R 4.3.0)
 P withr          3.0.2    2024-10-28 [?] RSPM (R 4.3.0)
 P xfun           0.50     2025-01-07 [?] RSPM
 P xtable         1.8-4    2019-04-21 [?] RSPM (R 4.3.0)
 P yaml           2.3.10   2024-07-26 [?] RSPM (R 4.3.0)

 [1] /home/eg66451/.cache/R/renv/library/shinydbanalysis-8138e944/linux-rhel-9.5/R-4.3/x86_64-pc-linux-gnu
 [2] /home/eg66451/.cache/R/renv/sandbox/linux-rhel-9.5/R-4.3/x86_64-pc-linux-gnu/d4a79710

 P ── Loaded and on-disk path mismatch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant