Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
tMysqlSCDELT component fails to insert and update rows to the destination table, as the date format used in the component is not aligned with Mysql default date format.
It is supposed to be YYYY-MM-DD, although the component tries to pass it in the format of DD-MM-YYYY, thus the insertion/update fails.
The scenario was tested based on the example for postgresql (components were switched to mysql version):
https://help.talend.com/reader/vfw2NwIrrNsiOsXIVOrdvA/0xr4RBLn6wT0~kw9KOhEAQ
here is the statement passed to database:
/* [tDBSCDELT_1] new rows sql */
INSERT INTO `employee_scd`
(`id`
, `name`
, `role`
, `salary`
, `start_date`
, `end_date`
, `active_status`
, `version`)
SELECT t.`id`
, t.`name`
, t.`role`
, t.`salary`
, '07-08-2019' /* FORMAT INCOMPATIBLE WITH MYSQL */
, NULL
, 1
, 1
FROM `employee` t
LEFT JOIN `employee_scd` d
ON d.`id` = t.`id`
WHERE ( d.`id` IS NULL)
;
from the code page once can see that the date is explicitly converted to the wrong format:
changeDateTime_tDBSCDELT_3_begin = routines.system.DBDateParser.getDBDateParser("mysql_id")
.getDateString("mysql_id", "DATETIME", (Long) start_Hash.get("tDBSCDELT_3"), "dd-MM-yyyy");
Is there any way to fix the formatting issue? Or just abandon the component and create own process?
Talend Version: 7.2.1
Hello,
Could you please refer to this article to see if it helps?
Best regards
Sabrina