Closed meztez closed 5 months ago
odbc::dbWriteTable(con, name = "#TEST", value = data.frame(A = 1:2), overwrite = TRUE, immediate = TRUE, batch_rows = 1)
Possibly related to #813, both of which I'd hypothesize are an outcome of #774.
I can't replicate with Microsoft's driver, but can do so with the Pro driver.
In the above, 1024 is indeed the value passed for batch_rows
in:
https://github.com/r-dbi/odbc/blob/d7b2351a598bf9b219e9de8384f5e5abc35c6327/R/dbi-table.R#L174
Sounds like some drivers don't support batch_rows
values other than the size of the data. It had been my sense that some drivers just didn't support batch_rows
values greater than the size of the data. This didn't come up in related issue threads, but I see this commit message does call that out.
@meztez Thanks for the report and the good investigation.
Can you test https://github.com/r-dbi/odbc/pull/816 to see if it helps with the issue?
Thanks again
It goes through without any errors, of course, you fixed it!
Thanks
MSSQL Server dbWriteTable fails without batch_row = nrow(value)
Created on 2024-06-06 with reprex v2.1.0
Database
``` > DBI::dbGetInfo(con) $dbms.name [1] "Microsoft SQL Server" $db.version [1] "14.00.3465" $host [1] "" $port [1] "" $sourcename [1] "" $drivername [1] "RStudio SQL Server ODBC Driver" $odbc.version [1] "03.52" $driver.version [1] "1.5.23.1024" $odbcdriver.version [1] "03.80" $supports.transactions [1] TRUE $supports.catalogs [1] TRUE $supports.schema [1] TRUE $getdata.extensions.any_column [1] TRUE $getdata.extensions.any_order [1] TRUE ```Session Info
``` > devtools::session_info() ─ Session info ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.4.0 (2024-04-24) os Ubuntu 22.04.4 LTS system x86_64, linux-gnu ui RStudio language (EN) collate C.UTF-8 ctype C.UTF-8 tz America/Montreal date 2024-06-06 rstudio 2024.04.0+735.pro3 Chocolate Cosmos (server) pandoc 3.1.12.3 @ /usr/bin/ (via rmarkdown) ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source askpass 1.2.0 2023-09-03 [2] CRAN (R 4.4.0) assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.4.0) base64enc 0.1-3 2015-07-28 [2] CRAN (R 4.4.0) bigrquery 1.5.1 2024-03-14 [2] CRAN (R 4.4.0) bit 4.0.5 2022-11-15 [2] CRAN (R 4.4.0) bit64 4.0.5 2020-08-30 [2] CRAN (R 4.4.0) blob 1.2.4 2023-03-17 [2] CRAN (R 4.4.0) cachem 1.1.0 2024-05-16 [2] CRAN (R 4.4.0) callr 3.7.6 2024-03-25 [2] CRAN (R 4.4.0) cellranger 1.1.0 2016-07-27 [2] CRAN (R 4.4.0) cli 3.6.2 2023-12-11 [2] CRAN (R 4.4.0) cloud.cap 0.6.13 2024-05-01 [2] Custom connect.cap 0.4.14 2024-05-01 [2] Custom crayon 1.5.2 2022-09-29 [2] CRAN (R 4.4.0) curl 5.2.1 2024-03-01 [2] CRAN (R 4.4.0) data.table 1.15.4 2024-03-30 [2] CRAN (R 4.4.0) DBI 1.2.3 2024-06-02 [2] CRAN (R 4.4.0) devtools 2.4.5 2022-10-11 [2] CRAN (R 4.4.0) digest 0.6.35 2024-03-11 [2] CRAN (R 4.4.0) ellipsis 0.3.2 2021-04-29 [2] CRAN (R 4.4.0) evaluate 0.23 2023-11-01 [2] CRAN (R 4.4.0) extraw 1.15.25 2024-06-06 [2] local fansi 1.0.6 2023-12-08 [2] CRAN (R 4.4.0) fastmap 1.2.0 2024-05-15 [2] CRAN (R 4.4.0) fs 1.6.4 2024-04-25 [2] CRAN (R 4.4.0) gargle 1.5.2 2023-07-20 [2] CRAN (R 4.4.0) getPass 0.2-4 2023-12-10 [2] CRAN (R 4.4.0) glue 1.7.0 2024-01-09 [2] CRAN (R 4.4.0) hms 1.1.3 2023-03-21 [2] CRAN (R 4.4.0) htmltools 0.5.8.1 2024-04-04 [2] CRAN (R 4.4.0) htmlwidgets 1.6.4 2023-12-06 [2] CRAN (R 4.4.0) httpuv 1.6.15 2024-03-26 [2] CRAN (R 4.4.0) httr 1.4.7 2023-08-15 [2] CRAN (R 4.4.0) jsonlite 1.8.8 2023-12-04 [2] CRAN (R 4.4.0) keyring 1.3.2 2023-12-11 [2] CRAN (R 4.4.0) knitr 1.47 2024-05-29 [2] CRAN (R 4.4.0) later 1.3.2 2023-12-06 [2] CRAN (R 4.4.0) lifecycle 1.0.4 2023-11-07 [2] CRAN (R 4.4.0) magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.4.0) memoise 2.0.1 2021-11-26 [2] CRAN (R 4.4.0) mime 0.12 2021-09-28 [2] CRAN (R 4.4.0) miniUI 0.1.1.1 2018-05-18 [2] CRAN (R 4.4.0) odbc 1.5.0 2024-06-05 [2] CRAN (R 4.4.0) openssl 2.2.0 2024-05-16 [2] CRAN (R 4.4.0) pillar 1.9.0 2023-03-22 [2] CRAN (R 4.4.0) pkgbuild 1.4.4 2024-03-17 [2] CRAN (R 4.4.0) pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.4.0) pkgload 1.3.4 2024-01-16 [2] CRAN (R 4.4.0) processx 3.8.4 2024-03-16 [2] CRAN (R 4.4.0) profvis 0.3.8 2023-05-02 [2] CRAN (R 4.4.0) promises 1.3.0 2024-04-05 [2] CRAN (R 4.4.0) ps 1.7.6 2024-01-18 [2] CRAN (R 4.4.0) purrr 1.0.2 2023-08-10 [2] CRAN (R 4.4.0) R.cache 0.16.0 2022-07-21 [2] CRAN (R 4.4.0) R.methodsS3 1.8.2 2022-06-13 [2] CRAN (R 4.4.0) R.oo 1.26.0 2024-01-24 [2] CRAN (R 4.4.0) R.utils 2.12.3 2023-11-18 [2] CRAN (R 4.4.0) R6 2.5.1 2021-08-19 [2] CRAN (R 4.4.0) rappdirs 0.3.3 2021-01-31 [2] CRAN (R 4.4.0) Rcpp 1.0.12 2024-01-09 [2] CRAN (R 4.4.0) readxl 1.4.3 2023-07-06 [2] CRAN (R 4.4.0) remotes 2.5.0 2024-03-17 [2] CRAN (R 4.4.0) reprex 2.1.0 2024-01-11 [2] CRAN (R 4.4.0) rlang 1.1.4 2024-06-04 [2] CRAN (R 4.4.0) rmarkdown 2.27 2024-05-17 [2] CRAN (R 4.4.0) rstudioapi 0.16.0 2024-03-24 [2] CRAN (R 4.4.0) sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.4.0) shiny 1.8.1.1 2024-04-02 [2] CRAN (R 4.4.0) stringi 1.8.4 2024-05-06 [2] CRAN (R 4.4.0) stringr 1.5.1 2023-11-14 [2] CRAN (R 4.4.0) styler 1.10.3 2024-04-07 [2] CRAN (R 4.4.0) tibble 3.2.1 2023-03-20 [2] CRAN (R 4.4.0) urlchecker 1.0.1 2021-11-30 [2] CRAN (R 4.4.0) usethis 2.2.3 2024-02-19 [2] CRAN (R 4.4.0) utf8 1.2.4 2023-10-22 [2] CRAN (R 4.4.0) utils.cap 1.4.46 2024-05-01 [2] Custom vctrs 0.6.5 2023-12-01 [2] CRAN (R 4.4.0) withr 3.0.0 2024-01-16 [2] CRAN (R 4.4.0) xfun 0.44 2024-05-15 [2] CRAN (R 4.4.0) xml2 1.3.6 2023-12-04 [2] CRAN (R 4.4.0) xtable 1.8-4 2019-04-21 [2] CRAN (R 4.4.0) yaml 2.3.8 2023-12-11 [2] CRAN (R 4.4.0) ```