Search code examples
sqletltalend

How to merge tables that don't have the same columns in Talend


For a project I'm using Talend, and I have 5 tables that have almost the same columns. But some of the tables have extra columns specific to the table For the moment I've been using tUnite to merge table that have the same columns

I would like to keep them while merging those table and I have no idea how to do it

Example :

Table 1 : col a, col b, col c

Table 2 : col a, col b, col c

Table 3 : col a, col b, col c, col d

I would like that when I'm merging those table col d is merge but appear with no values (blank or null, whatever) for table 1 and table 2

Is there any component that could help me do that ? Am I missing something obvious ?


Solution

  • Your job should be designed as below :

    tdbinput1(table 1) -> main                       -> 
                                                     |
    tdbinput2(table 2) ->    main                    ->   tunite -> tlogrow
                                                     |
    tdbinput3(table 3) -> main ->tFilterColumns->main 
    

    In the tFilterColumns component you can ignore your col d

    See below documentation of tFilterColumns

    https://help.talend.com/r/fr-FR/7.2/processing/tfiltercolumns-standard-properties

    Or if col d is needed just add the columns using tMap component

    tdbinput1(table 1) -> main ->tmap1 (add col d)    -> 
                                                     |
    tdbinput2(table 2) ->    main ->tmap2 (add col d)                ->   tunite -> tlogrow
                                                     |
    tdbinput3(table 3) ->  main