ropensci / rfishbase

R interface to the fishbase.org database
https://docs.ropensci.org/rfishbase
109 stars 40 forks source link

distribution function retuning this error #276

Open AnthonyBasooma opened 6 months ago

AnthonyBasooma commented 6 months ago

Error in db_query_fields.DBIConnection(): ! Can't query fields. Caused by error: ! rapi_prepare: Failed to prepare query SELECT * FROM species AS q01 WHERE (0 = 1) Error: Catalog Error: Table with name species does not exist! Did you mean "pg_views"? LINE 2: FROM species AS q01 ^ Run rlang::last_trace() to see where the error occurred.

btupper commented 5 months ago

Hello,

I'm encountering the same issue. It doesn't seem to depend upon the value provided by the user to the species_list (I thought it might, but now I think I was chasing a red herring.)

Thanks! Ben

r = rfishbase::distribution(species_list = NULL, server = "fishbase")

# Error in `db_query_fields.DBIConnection()`:
# ! Can't query fields.
# Caused by error:
# ! rapi_prepare: Failed to prepare query SELECT *
# FROM species AS q01
# WHERE (0 = 1)
# Error: Catalog Error: Table with name species does not exist!
# Did you mean "pg_views"?
# LINE 2: FROM species AS q01
#              ^
# Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()

# <error/rlang_error>
# Error in `db_query_fields.DBIConnection()`:
# ! Can't query fields.
# Caused by error:
# ! rapi_prepare: Failed to prepare query SELECT *
# FROM species AS q01
# WHERE (0 = 1)
# Error: Catalog Error: Table with name species does not exist!
# Did you mean "pg_views"?
# LINE 2: FROM species AS q01
#              ^
# ---
# Backtrace:
#      ▆
#   1. ├─rfishbase::distribution(species_list = NULL, server = "fishbase")
#   2. │ └─rfishbase::faoareas(...)
#   3. │   ├─... %>% dplyr::collect()
#   4. │   └─rfishbase:::species_subset(...)
#   5. │     ├─... %>% collect()
#   6. │     ├─dplyr::select(...)
#   7. │     ├─dplyr::tbl(db, "species")
#   8. │     ├─duckdb:::tbl.duckdb_connection(db, "species")
#   9. │     ├─base::NextMethod("tbl")
#  10. │     └─dplyr:::tbl.DBIConnection(db, "species")
#  11. │       ├─dplyr::tbl(...)
#  12. │       └─dbplyr:::tbl.src_dbi(...)
#  13. │         └─dbplyr::tbl_sql(c(subclass, "dbi"), src = src, from = from, ...)
#  14. │           ├─vars %||% dbplyr_query_fields(src$con, from_sql)
#  15. │           └─dbplyr:::dbplyr_query_fields(src$con, from_sql)
#  16. │             └─dbplyr:::dbplyr_fallback(con, "db_query_fields", ...)
#  17. │               ├─rlang::eval_bare(expr((!!fun)(con, ...)))
#  18. │               └─dbplyr:::db_query_fields.DBIConnection(con, ...)
#  19. ├─dplyr::collect(.)
#  20. ├─dplyr::collect(.)
#  21. ├─dplyr::select(., "SpecCode", Species = sci_name)
#  22. └─dplyr::mutate(., sci_name = paste(Genus, Species))
# Run rlang::last_trace(drop = FALSE) to see 6 hidden frames.
r = rfishbase::distribution(species_list = "Ablennes hians", server = "fishbase")
# Error in `db_query_fields.DBIConnection()`:
# ! Can't query fields.
# Caused by error:
# ! rapi_prepare: Failed to prepare query SELECT *
# FROM species AS q01
# WHERE (0 = 1)
# Error: Catalog Error: Table with name species does not exist!
# Did you mean "pg_views"?
# LINE 2: FROM species AS q01
#              ^
# Run `rlang::last_trace()` to see where the error occurred.
sessionInfo()

# R version 4.2.2 (2022-10-31)
# Platform: x86_64-conda-linux-gnu (64-bit)
# Running under: Rocky Linux 8.8 (Green Obsidian)
# 
# Matrix products: default
# BLAS/LAPACK: /mnt/modules/bin/dada2/1.26/lib/libopenblasp-r0.3.21.so
# 
# locale:
#  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
# [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] reprex_2.0.2     refdbtools_0.1.0 dplyr_1.1.2     
# 
# loaded via a namespace (and not attached):
#  [1] httr_1.4.4        pkgload_1.3.2     contentid_0.0.18  bit64_4.0.5      
#  [5] vroom_1.6.3       jsonlite_1.8.4    rfishbase_4.1.2   brio_1.1.3       
#  [9] shiny_1.7.4       assertthat_0.2.1  askpass_1.1       yaml_2.3.7       
# [13] remotes_2.4.2     progress_1.2.2    sessioninfo_1.2.2 charlier_0.1     
# [17] pillar_1.9.0      glue_1.6.2        digest_0.6.31     promises_1.2.0.1 
# [21] htmltools_0.5.4   httpuv_1.6.8      clipr_0.8.0       XML_3.99-0.16.1  
# [25] pkgconfig_2.0.3   devtools_2.4.5    purrr_1.0.1       xtable_1.8-4     
# [29] processx_3.8.0    later_1.3.0       tzdb_0.4.0        tibble_3.2.1     
# [33] openssl_2.0.5     generics_0.1.3    usethis_2.1.6     ellipsis_0.3.2   
# [37] cachem_1.0.6      withr_2.5.0       cli_3.6.1         magrittr_2.0.3   
# [41] crayon_1.5.2      mime_0.12         memoise_2.0.1     evaluate_0.20    
# [45] ps_1.7.2          fs_1.6.0          fansi_1.0.4       xml2_1.3.3       
# [49] pkgbuild_1.4.0    profvis_0.3.7     tools_4.2.2       prettyunits_1.1.1
# [53] hms_1.1.3         lifecycle_1.0.3   stringr_1.5.0     callr_3.7.3      
# [57] compiler_4.2.2    duckdb_0.9.2-1    rlang_1.1.3       rstudioapi_0.14  
# [61] htmlwidgets_1.6.1 miniUI_0.1.1.1    rmarkdown_2.20    testthat_3.1.6   
# [65] rentrez_1.2.3     DBI_1.1.3         roxygen2_7.2.3    curl_5.0.0       
# [69] R6_2.5.1          knitr_1.42        bit_4.0.5         fastmap_1.1.0    
# [73] utf8_1.2.2        commonmark_1.8.1  rprojroot_2.0.3   readr_2.1.5      
# [77] desc_1.4.2        stringi_1.7.12    parallel_4.2.2    Rcpp_1.0.10      
# [81] vctrs_0.6.2       dbplyr_2.3.0      tidyselect_1.2.0  xfun_0.36        
# [85] urlchecker_1.0.1 
JustinHinLo commented 1 month ago

Hello,

I tried to use this distribution table 2 weeks ago and it worked fine but I encountered the same issue today when I tried to use it.

distribution(server = "fishbase") Error in db_query_fields.DBIConnection(): ! Can't query fields. Caused by error: ! rapi_prepare: Failed to prepare query SELECT * FROM (FROM species) q01 WHERE (0 = 1) Error: Catalog Error: Table with name species does not exist! Did you mean "pg_views"? LINE 2: FROM (FROM species) q01 ^ Run rlang::last_trace() to see where the error occurred.