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

Multiple valid methods for signature: target signature ‘DatabaseConnectorJdbcConnection#Id’. #265

Open
ablack3 opened this issue Jan 17, 2024 · 0 comments

Comments

@ablack3
Copy link
Collaborator

ablack3 commented Jan 17, 2024

DatabaseConnnector exports multiple valid methods for some DBI methods. Method selection is then somewhat ambiguous and done by R.

Expected behavior - There is one unique method selected for a given generic function signature.

con <- DBI::dbConnect(
  DatabaseConnector::DatabaseConnectorDriver(),
  dbms = "postgresql",
  server = Sys.getenv("CDM5_POSTGRESQL_SERVER"),
  user = Sys.getenv("CDM5_POSTGRESQL_USER"),
  password = Sys.getenv("CDM5_POSTGRESQL_PASSWORD"))
#> Connecting using PostgreSQL driver

write_schema <- Sys.getenv("CDM5_POSTGRESQL_SCRATCH_SCHEMA")

DBI::dbWriteTable(con, DBI::Id(schema = write_schema, table = "test"), cars)
#> Note: method with signature 'DBIConnection#Id' chosen for function 'dbWriteTable',
#>  target signature 'DatabaseConnectorJdbcConnection#Id'.
#>  "DatabaseConnectorConnection#ANY" would also be valid
#> Inserting data took 0.322 secs
DBI::dbRemoveTable(con, DBI::Id(schema = write_schema, table = "test"))
#> Note: method with signature 'DBIConnection#Id' chosen for function 'dbRemoveTable',
#>  target signature 'DatabaseConnectorJdbcConnection#Id'.
#>  "DatabaseConnectorConnection#ANY" would also be valid
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.109 secs
#>   |                                                                              |                                                                      |   0%  |                                                                              |======================================================================| 100%
#> Executing SQL took 0.109 secs
#> [1] TRUE


DBI::dbDisconnect(con)

sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Sonoma 14.0
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Amsterdam
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] bit_4.0.5               dplyr_1.1.4             compiler_4.3.1         
#>  [4] tidyselect_1.2.0        reprex_2.0.2            Andromeda_0.6.4        
#>  [7] blob_1.2.4              yaml_2.3.7              fastmap_1.1.1          
#> [10] R6_2.5.1                generics_0.1.3          knitr_1.44             
#> [13] backports_1.4.1         checkmate_2.3.0         tibble_3.2.1           
#> [16] R.cache_0.16.0          DBI_1.2.0               pillar_1.9.0           
#> [19] R.utils_2.12.2          rlang_1.1.2             utf8_1.2.4             
#> [22] cachem_1.0.8            xfun_0.40               fs_1.6.3               
#> [25] bit64_4.0.5             RSQLite_2.3.2           memoise_2.0.1          
#> [28] cli_3.6.2               withr_2.5.2             magrittr_2.0.3         
#> [31] digest_0.6.33           rstudioapi_0.15.0       rJava_1.0-6            
#> [34] DatabaseConnector_6.3.2 hms_1.1.3               lifecycle_1.0.4        
#> [37] R.methodsS3_1.8.2       R.oo_1.25.0             vctrs_0.6.5            
#> [40] evaluate_0.23           glue_1.6.2              SqlRender_1.16.1       
#> [43] styler_1.10.2           fansi_1.0.6             rmarkdown_2.24         
#> [46] purrr_1.0.2             pkgconfig_2.0.3         tools_4.3.1            
#> [49] htmltools_0.5.6

Created on 2024-01-17 with reprex v2.0.2

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