Reading data from mysql table in talend and writing it flatfile
- We need to identify table we need to read.
- Drop tmysqlinput component and enter your db credentials
- Write the “select * from sakila.city” in the sql query section of component.
- Now click on Guess Schema to get schema of the table.
- Next drag tfileoutputdelimited component from pallet on to your job (assuming we will create a delimited flatfile)
- now right click on tmysqlinput and select row and link it to tfileoutputdelimited
- next click on sync column properties in tfileoutputdelimited component to get schema of input row.
- Specify path for output file
- Now your job is almost ready - but you see small Warning symbol on both the component - this is because our table has a date column and it is preferred to have a date format specified against this column in schema definition
- click on schema of tmysqlinput and specify date pattern as "dd-MM-yyyy"
and run the JOB it should finish successfully.
Try to play with file options of tfileoutputdelimited as below and see the impact on content of file generated