Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I try inserting data from a csv file into a postgres database. In the csv file several cells are empty. In my schema the columns are all nullable.
Nevertheless, talend writes empty strings '' into the database instead of null values.
Do you have any idea how I can insert null values?
Thanks
Hein
Thank you for your quick answers.
I had hoped there was a checkbox or something I missed.
But your solution will definitely work.
hello ,
i have one column for monile number and some user not inserted value in that column ..
so i wand to replace that value by dot '.'
Thank you
If you are using the suscription version, you can leverage Dynamic schema and do something like that:
Job Overview
File extract
File Schema
Extract Dynamic Schema
tLog
The code in the tJavaRow is
Dynamic columns = input_row.dyn; //extract Dynamic
//looping on each columns of the row for (int i = 0; i < columns.getColumnCount(); i++) { DynamicMetadata columnMetadata = columns.getColumnMetadata(i); //extracting metadata
//if empty then replace by null if(columnMetadata.getType().equals("id_String") && ((String)columns.getColumnValue(i)).isEmpty()) { columns.setColumnValue(i, null); } }
//replacing the stream row by the new updated one output_row.dyn = columns;
Hi,
it is also possible to use the "tConvertType" component with the "Set empty values to Null before converting" option between your csv file component and your database component.
It saves a lot of time to me, I hope it will be the same for you !
Regards