Skip to main content

my configuration:
Use Multi-Row Operation  is close
and 
Max Cache Size Per Batch (Entries) is “-1”

origin:
{
    "table": "tableName",
    "op_type": "I",
    "op_ts": "2022-04-25 09:01:56.000000",
    "current_ts": "2022-04-25T09:02:01.014000",
    "pos": "00000000020000939589",
    "after": {
       “ROW_ID”:”123456”,
        "LAST_UPD": "2022-04-25 01:01:54"
    }
}
Destinations is jdbc producer

I can not update the LAST_UPD into mysql column “last_update_date” 
please give me some advice

change the column type of  ”last_update_date“  to varchar in mysql , the date can update


please change the column name LAST_UPD to last_update_date and i believe it will solve your issue.


by the way I have set a mapping
Field to Column Mapping:
{
        "paramValue": ?,
        "dataType": "USE_COLUMN_TYPE",
        "columnName": "last_update_date",
        "field": "/after/LAST_UPD"
    }


ok , i see . I hope the data type for the column are same in both source and destination. if it’s  not then it will fail.

In this case if the last_updated_date column is string type or data time type then you should send same data type to destination JDBC producer.


how to change the “STRING” type  to “DATETIME” ?   
I need to change “LAST_UPD” ‘s  type to ”DATETIME“
and send it to mysql as “DATETIME’

use JavaScript Evaluator?


Can you please refer below sample code and try it and let me know if it helps. 

 

https://docs.streamsets.com/portal/datacollector/latest/help/datacollector/UserGuide/Expression_Language/Functions.html#concept_qkr_trf_sw

${time:extractDateFromString('2017-05-01 20:15:30.915','yyyy-MM-dd HH🇲🇲ss.SSS')}

it work!  thank you very much


Reply