-
Notifications
You must be signed in to change notification settings - Fork 107
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
dbWriteTable in Oracle does not work with the new version of DBI and ODBC #710
Comments
Thanks for your report. Can you confirm that with The warning message is OK - something we are aware of and plan on addressing in an upcoming release. |
Also, had a chance to chase down the DBI 1.1.3 vs 1.2.0 issue - updated the issue you raised in Thanks again for your detailed report. |
Hello @detule, Thanks for the prompt response, I performed the suggested test and I see that it works correctly if the table name does not have an underscore. However, for our case all our databases have undersocres in the table names. I think it is common for table names to have underscores. # Load libraries
library(DBI)
# Open Database Connection
conn <- dbConnect(
odbc::odbc(),
dsn="*****",
timezone = "America/Bogota", timezone_out = "America/Bogota"
)
# Write Data to Database
dbWriteTable(
conn = conn,
name = SQL("*****.TABLETEST"),
value = mtcars
)
#> Note: method with signature 'Oracle#character' chosen for function 'odbcConnectionColumns',
#> target signature 'Oracle#SQL'.
#> "OdbcConnection#SQL" would also be valid
# Overwrite Data to Database
dbWriteTable(
conn = conn,
name = SQL("*****.TABLETEST"),
value = mtcars,
overwrite = TRUE,
append = FALSE
)
# Append Data to Database
dbWriteTable(
conn = conn,
name = SQL("*****.TABLETEST"),
value = mtcars,
overwrite = FALSE,
append = TRUE
)
# Close Database Connection
dbDisconnect(conn = conn) Created on 2023-12-23 with reprex v2.0.2 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.2 (2023-10-31)
#> os Oracle Linux Server 8.7
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Bogota
#> date 2023-12-23
#> pandoc 3.1.1 @ /usr/lib/rstudio-server/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bit 4.0.5 2022-11-15 [1] CRAN (R 4.3.2)
#> bit64 4.0.5 2020-08-30 [1] CRAN (R 4.3.2)
#> blob 1.2.4 2023-03-17 [1] CRAN (R 4.3.2)
#> cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.2)
#> DBI * 1.1.3 2022-06-18 [1] CRAN (R 4.3.2)
#> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.2)
#> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.2)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.2)
#> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.2)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.2)
#> hms 1.1.3 2023-03-21 [1] CRAN (R 4.3.2)
#> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2)
#> knitr 1.45 2023-10-30 [1] CRAN (R 4.3.2)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.2)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.2)
#> odbc 1.4.1 2023-12-21 [1] CRAN (R 4.3.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.2)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.2)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.2)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.2)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.2)
#> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.3.2)
#> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.2)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.2)
#> rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.2)
#> rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.2)
#> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.2)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.2)
#> styler 1.10.2 2023-08-29 [1] CRAN (R 4.3.2)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.2)
#> withr 2.5.2 2023-10-30 [1] CRAN (R 4.3.2)
#> xfun 0.41 2023-11-01 [1] CRAN (R 4.3.2)
#> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.2)
#>
#> [1] /u01/rstudio-server/pre.data/R
#> [2] /opt/R/4.3.2/lib/R/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
Thank you @detule, Is there any branch that we can test to support them with tests? |
We would like to find some way to support you with ODBC and DBI testing with Oracle, because for example the last 3 versions of ODBC have errors with Oracle, and we clearly understand that this has happened because the community is testing after it comes out a new version and not before a new version is released. Regards, |
Thanks @apalacio9502 / appreciate the sentiment, and the offer to help test. We too are interested in making sure we don't disrupt the workflow for
Thanks again for your patience. |
Apologies for the delay. I can now confirm that the problem has been successfully resolved. I conducted a test using ODBC (dev) + DBI (1.1.3) or ODBC (dev) + DBI (1.2.1). I believe this matter can be marked as complete with reference to the Oracle-related discussion on GitHub (r-dbi/DBI#446). Regards, |
Hello @hadley,
dbWriteTable in Oracle does not work with the new version of DBI and ODBC. We currently use version 2023-05 of the Oracle professional drivers provided by Posit with the Posit Connect license.
Below I leave the different scenarios where the versions of ODBC and DBI vary, it is important to highlight that in each case the dbWriteTable method is called three times:
Case 0: DBI 1.1.3 and ODBC 1.3.4 (0 Errors)
Created on 2023-12-23 with reprex v2.0.2
Session info
Case 1: DBI 1.2.0 and ODBC 1.3.4 (3 Errors)
Created on 2023-12-23 with reprex v2.0.2
Session info
Case 2: DBI 1.1.3 and ODBC 1.4.1 (1 Message and 2 Errors)
Created on 2023-12-23 with reprex v2.0.2
Session info
Case 3: DBI 1.2.0 and ODBC 1.4.1 (3 Errors)
Created on 2023-12-23 with reprex v2.0.2
Session info
I hope these reprex are helpful to correct the error.
Regards
The text was updated successfully, but these errors were encountered: