Data type conversion in Talend Community Vesrsion

Five Stars

Data type conversion in Talend Community Vesrsion

Dear team,

 

Now I've created one job to load data from CSV to MySql database. The data type from csv is not match to mysql table data type, so I need to change data type. Then I use tConvertType but I got null or error after running the job.

 

I work around with configuration in tConvertType and tMap but it doesn't work. For example there is phone number in csv with integer data type but i have to convert to string before loading to mysql database. could anyone please give me the sample job like this.

 

Thank you.

Community Manager

Re: Data type conversion in Talend Community Vesrsion

For the telephone number you can simply set the column for the file import component (I assume you are using a tFileInputDelimited) to String.

 

With regard to the errors you were getting, could you post them? 

Nine Stars

Re: Data type conversion in Talend Community Vesrsion

use this string.valueof(row1.phonenumber), or else in the csv while writing metadata, you can change to string instead of using integer, this both of the solutions will work

 

 

Community Manager

Re: Data type conversion in Talend Community Vesrsion

This will not work. If a telephone number such as 07555123456 is read as a number by the tFileInputDelimited, then the leading zero will be removed and you will end up with 7555123456. The telephone number must be read as a String from the beginning.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog