Fetching Child Table records based on Parent Table key

Four Stars

Fetching Child Table records based on Parent Table key

Hello,

 

I have a requirement like I need to fetch the data from Parent and Child Tables and write it to a file.

Example:

ParentRecord1
ChildRecord1
ChildRecord2
ParentRecord2
ChildRecord1
ChildRecord2

 

How to develope this in talend. please help

 

Thanks in advance

Nine Stars

Re: Fetching Child Table records based on Parent Table key

Are you connecting to database to retrieve records from Child & Parent table? How does you setup the relationship between these two tables - some sample records from both the tables, your expected output and whatever you have tried so far would help.

Four Stars

Re: Fetching Child Table records based on Parent Table key

Hi Abhishek,

 

Thanks for the reply.

I connected to salesforce input to get the data from both parent and child records and store them to 2 fileoutput delimited files. 

I was struck here. don't know how to proceed further. I am new to talend.

SalesforceInput (to get parent records) --> Fileoutputdelimited

SalesforceInput (to get child  records) --> Fileoutputdelimited

 

don't know how to join these 2 tables to convert them to specified format.

 

 

Nine Stars

Re: Fetching Child Table records based on Parent Table key

Talend has tMap & tJoin which performs inner or outer join between main data flow and lookup data flow - in your case parent records and child records.
Four Stars

Re: Fetching Child Table records based on Parent Table key

how could I get the format using tmap and joins 

FOrmat I needed was:

Parent1

Child1

child2

Parent2

Child21

Child22

 

I tried out the below things. 

SalesforceInput(to get parent records) -> fileoutputDelimited -> Join ---> TfileoutputDelimited

                                                                                                        ^

SalesforceInput(to get child records) -> fileoutputDelimited -------|

Outpout of this job is 

Parent1Child1Child2

Parent2Child11Child22

 

Please help

 

Nine Stars

Re: Fetching Child Table records based on Parent Table key

Something like this would help -
1. you could put a condition on your tJoin (or tMap) output column - if parentrow is not null then parentrecord else childrecord - which might give you the complete data in a single column and not in three columns
2. you could use tDenormalize to transpose Rows to Columns

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads