-
Notifications
You must be signed in to change notification settings - Fork 88
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
Failed to output chinese emoji to mysql #306
Comments
Hello, @YunLongND
I could insert the following emoji into the MySQL database without any special configuration. Could you tell me more detail about your environment (configuration, database version, and so on)? CREATE TABLE `example` (
`id` bigint DEFAULT NULL,
`account` bigint DEFAULT NULL,
`time` timestamp NULL DEFAULT NULL,
`purchase` timestamp NULL DEFAULT NULL,
`comment` text COLLATE utf8mb4_general_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
@hiroyuki-sato Thank you very much for your attention to my question.
I noticed that when I use mode truncate_insert to transfer data from Redshift to MySQL, embed first creates a temporary table in mysql, then stores the data in the temporary table, and then transfers the data in the temporary table to the target table. |
Hello, @YunLongND
I got the same error message if the target table does not support
I inserted the same data using |
@hiroyuki-sato |
Hello, @YunLongND I succeed insert emoji in the following environment and configuration.
in:
type: file
path_prefix: sample_2
parser:
charset: UTF-8
newline: LF
type: csv
delimiter: ','
quote: '"'
escape: '"'
null_string: 'NULL'
trim_if_not_quoted: false
skip_header_lines: 1
allow_extra_columns: false
allow_optional_columns: false
columns:
- {name: id, type: long}
- {name: comment, type: string}
out:
type: mysql
host: 127.0.0.1
mode: truncate_insert
user: user
password: password
database: embulk_test
table: example docker-compose.yml
|
I had the exact same problem, and reading the documents, it seems not possible to solve the problem only by setting connector options. https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-conversion.html
setting
using https://stackoverflow.com/questions/44591895/utf8mb4-in-mysql-workbench-and-jdbc
I think upgrading the driver version to 5.1.47+ or 8.0.13+ can solve the issue. Current solution is to set the |
Hello, @rajyan You can change Connecotor/J to 5.1.47+ (not Connector/J 8.x) using I think 🍣 is the four-byte UTF-8 characters.
About updating the driver. embulk/embulk-input-jdbc#237 (comment)
See also: embulk/embulk-input-jdbc#238 |
Hi, @hiroyuki-sato Thank you for noticing I created a reproducible repo for the error. The error occurred by setting |
Sorry, I understood my problem and |
Updated the repro by adding I could confirm that the error only happens in the current connector, and upgrading Connecotor/J to 5.1.49 can solve the error. |
Sorry never mind. It was just my mysql client. I can confirm that upgrading to Connecotor/J to 5.1.49 can solve the error! 😄 |
Thank you for because there are several simple work arounds/solutions like using |
Summary of the problem
error if you are not setting This error occurs even you are setting
because Connector/J before version 5.1.47 uses utf8 (utf8mb3) as a default for the connection with The solution now is
|
My mysql uses code utf8mb4, and mysq's temporary table code is utf8mb4,
When I insert data into mysql temporary table, it has the following error:
org.embulk.exec.PartialExecutionException: java.lang.RuntimeException: java.sql.BatchUpdateException: Incorrect string value: '\xF0\x9F\xA4\xA3' for column ......
Can someone help me solve this problem? thanks.
The text was updated successfully, but these errors were encountered: