Question

I'm working in Talend and trying to create a table using data from a csv file. The database already exists but it has no tables as I need to be able to create one using the Talend components. I am using MySQL.

I am seriously struggling to find tutorials on this. Please help!

Was it helpful?

Solution

It's quite a easy task nicely covered by the user manual, but let me give you some starting insights:

Define a database connection. This will give you the possibility to record a connection detail to the DB you can reuse. And it's easier to check, too --> http://www.etladvisors.com/2012/08/22/managing-multiple-db-env/ If you don't need dev/test/prod decoupling, you can follow just the first part of the tutorial

Now design your job like:

tFileDelimitedInput---->[some data transformation stuff]--->tMySqlOutput

Fill the "Schema" section of tFileDelimitedInput to match your CSV (columns, datatype); you'll need to fill some other parameters too (ie the separation char, the encoding...)

Finally, in tMySqlOutput select your just recorded db connection from the dropdown list and fill the table name. If you select "Create table if not exists" on Table Action parameter, the table will be automatically created following your Schema (if you need not nullable or PK conditions you must define it in your Schema as well)

Be careful! If you change the input schema coming from your tFileDelimitedInput component you need to sync the changes to your output schema (in tMySqlOutput). Talend should ask for it automatically. If it doesn't, you can click "Sync Schema" at any time inside tMySqlOutput

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top