When I try to ETL the data of s3 to rds in embulk, I get a FOREIGN_KEY constraint error.
Specifically, the error is as follows:
java.lang.RuntimeException: com.mysql.jdbc.exception.jdbc4.MySQLIntegrityConstraintViolationException:Cannot delete or update a parent row:a foreign key constraint failures
(`outputdb`.`TABLE_HISTORY`, CONSTRAINT`fk_TABLE_HISTORY_TABLE_HISTORY1`FOREIGN KEY(`PRIMARY_ID`,`SECOND_PRIMARY_ID`) REFERENCES`TABLE)
Primary key is configured in two columns (complex principal key) as shown above.
Set set FOREIGN_KEY_CHECKS=0; on mysql side
Embulk out describes the configuration as follows:
before_load: 'set FOREIGN_KEY_CHECKS=0;'
Now Resolved:
Look for Foreign Key Errors and check Foreign Key with the following command
SHOW CREATE TABLE table name;
Removed the Foreign Key.
ALTER TABLE table name DROP FOREIGN KEY foreign key name;
© 2024 OneMinuteCode. All rights reserved.