Load CSV to Postgres: foreign key table

Seven Stars

Load CSV to Postgres: foreign key table

Hi,

 

I have a csv file to load in several Postgres' tables. I loaded data on the first two table and then I want to fill up the third one. To do that, I need the primary key from table1 and table2. I attached myJob and my tMap2 where I am doing a lookup with the first two table filled.

 

The problem is that the result is always 0 for fk1 (row5.uid_policy) and fk2 (row3.uid_rule_group). How can I solve it? Thank you in advance!

 

 


Accepted Solutions
Forteen Stars

Re: Load CSV to Postgres: foreign key table

@Emanuele89 , I have done and i am attaching the job here you can check,i am getting 4 records out of your

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

All Replies
Employee

Re: Load CSV to Postgres: foreign key table

Hi,

 

    In your tMap, I am not able to see any join conditions (sample as shown below)

 

image.png

 

You will have to select inner join between Main table and two lookup tables based on columns which are present in both tables. Could you please change it and verify it? If you are still facing problem, please share a sample file for both main table and lookup with columns to join and I can show it from Studio.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Seven Stars

Re: Load CSV to Postgres: foreign key table

You're right!! I completly forgot to set the join condition!! 

I see the values now, but I have one more problem: my table "rem_v_rule_group" has the following values (example):

 

uid     val

1        COMPLETED

2        COMPLETED

3        COMPLETED

4        COMPLETED

5        COMPLETED

 

val assume always the same value. Just uid, as primary key, is different. When I use the join condition in tMap2, on val, the value returned is always 24...the last uid in my table. I also tried to modify the join condition (All Matches, Inner Join), but I got 574 values in return instead of 24.

Employee

Re: Load CSV to Postgres: foreign key table

Hi,

 

    I am slightly confused here!

 

    If you are joining on a key and the join is resulting in multiple matched records, it will take the unique match based on last record of lookup. So it is working as expected. If you want to get all match combinations, you will have to select All Match and it will give all combinations based on match.

 

    Could you please explain what you are trying to achieve here by join? Please share sample input files for tMap, expected output data and the data you are getting for this tMap. Then we should be able to help you better :-)

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Forteen Stars

Re: Load CSV to Postgres: foreign key table

@Emanuele89 ,in both lookup table section row3 and row5 you need to join,have you did in that way? can you share the tMap join screenshot.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Seven Stars

Re: Load CSV to Postgres: foreign key table

Hi,

 

I am attaching sample.csv file as input file and my expected output (.xls). I hope the issue is clear explaned.

Seven Stars

Re: Load CSV to Postgres: foreign key table

@manodwhb 

I am attached my tMap.

Forteen Stars

Re: Load CSV to Postgres: foreign key table

@Emanuele89 , I have done and i am attaching the job here you can check,i am getting 4 records out of your

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Forteen Stars

Re: Load CSV to Postgres: foreign key table

@Emanuele89 ,because of duplicate data you were not getting.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Seven Stars

Re: Load CSV to Postgres: foreign key table

@manodwhb 

I cannot import the project because of my Talend version. I am usign 7.0. 

Seven Stars

Re: Load CSV to Postgres: foreign key table

@manodwhb 

Ok! Some way I import the job and run it. But uid_rule_group in tLogRow3 sholud be 1,2,3,4 and not 4,4,4,

4.

 

Thank you for your help!!

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch