r-dbi/DBI

DBI::dbWriteTable doesn't append beyond specific number of rows.

nehameharwal13 opened this issue · 2 comments

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://stackoverflow.com/ or https://community.rstudio.com/.

Please include a minimal reproducible example (AKA a reprex). If you've never heard of a reprex before, start by reading https://www.tidyverse.org/help/#reprex.

IMPORTANT: If your code requires accessing a specific database (with e.g. odbc, RSQLite, RJDBC), the issue you are experiencing is likely not a problem with the DBI package. Please file an issue with the appropriate DBI backend instead.


Brief description of the problem

# insert reprex here
  • Currently working with Professional Rstudio drivers

  • I have set all varchar to max in Sqlserver table as well but it didnt help.

     diag_test <- diag[1:1025]
     system.time({
     DBI::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
     })
    

Error in result_insert_dataframe(rs@ptr, values) :
nanodbc/nanodbc.cpp:1587: HY000: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 5 (""): The supplied length is not valid for data type nvarchar(max). Check the source data for invalid lengths. An example of an invalid length is data of nchar type with an odd length in bytes., Timing stopped at: 0.049 0.002 0.135

  • It works with fewer rows though.

Few subset examples:

  diag_test <- diagcopy[1:1024]
  system.time({
  DBI::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
  })
  user  system elapsed 
  0.042   0.000   0.109 


  diag_test <- diagcopy[1000:1025]
  system.time({
  odbc::dbWriteTable(con, "urban_prodbi_diag", diag_test, append = TRUE)
   })
   user  system elapsed 
   0.014   0.000   0.074 
  • Insert didnt give any error through RODBC package on the same table schema and dataframe.

This issue was moved by krlmlr to r-dbi/odbc#225.