RedOakStrategic / redshiftTools

R Tools to use Amazon Redshift with R
Other
4 stars 0 forks source link

UTF-8 character insert errors #2

Closed JakeRuss closed 4 years ago

JakeRuss commented 4 years ago

Issue copy and pasted from: https://github.com/sicarul/redshiftTools/issues/52

Double byte char types like utf-8 such as JP characters are actually a different size in redshift storage for varchar, needs to accommodate these double type types. Can you update the nchar function in tabledefinitions.R line 4 to read:

maxChar = max(nchar(col, type='bytes'), na.rm=T)

Sample code to create the issue:

dat1 <- data.frame(A="あいう",stringsAsFactors = F) b=rs_create_table(dat1, dbcon=con, table_name='mytesttable', split_files=1)

Above results in

ERROR: Load into table 'uvroyetkqxjdgcbn' failed. Check 'stl_load_errors' system table for details.

In stl_load_errors is says

String length exceeds DDL length
JakeRuss commented 4 years ago

Fixed by #7