Closed ecoffingould closed 5 months ago
Thanks, Eric. Is the following relevant?
Thank you for the quick response!
My tables are in utf8mb4 — I checked the create statement for table_name_here. The default character set for my database + schema are both utf8mb4. My MySQL server version is 8.0.35
That makes sense with why this write works when load_data_local_infile is set to FALSE. And it's also why the error message is so weird — cause i've double- and triple-checked and the encodings are utf8mb4.
I think that whatever is happening in the load_data_local_infile step is somehow encoding the data as utf8mb3?
Thanks. With https://stackoverflow.com/a/75421637/946850, it becomes apparent that
https://github.com/r-dbi/RMariaDB/blob/24e25206f7739d4493dea2dda4cef6c8abed35d6/R/table.R#L61-L68
is wrong and should be utf8mb4
instead. Would you like to contribute a PR?
Here you are!
Thanks for the PR!
I am writing a data set with emojis in it to a MySQL database. When the load_data_local_infile flag is set to TRUE (which is necessary for speed purposes), the write fails due to encoding issues. When the load_data_local_infile flag is not called or set to FALSE, the write succeeds, but goes much slower.
I have triple-checked the encoding in all other places — the MySQL database, the connection, the R file itself. All are encoded to utf-8, and can be written normally if the load_data_local_infile flag isn't used. This is also an issue that I didn't have on the old RMySQL package.
I also tried specifying the charset or the encoding in the dbConnect() stage, but that didn't seem to do anything. This is driving me crazy, please help.