Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

insert/Update data into DB

I am new to talend world and trying learn the flow of data. 

 

I have a customer csv file which i need to load into a postgresql db. I could have done this with tdboutput component but wanted to do this using insert query.

So I am using 2 components. 

tfileinputdelimited -> tdbrow.

 

I used this query in my tdbrow component:

"INSERT INTO customers (cust_id, cust_name, cust_lname, cust_email, cust_city, cust_type) values
(row1.Cust_ID, row1.Cust_Fname, row1.Cust_Lname, row1.Cust_Email, row1.Cust_City, row1.Cust_Type)"

 

This is the error I am getting:

Exception in component tDBRow_1 (insertjb)
org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "row1"

 

Thanks in advance. 

Labels (2)
3 Replies
manodwhb
Champion II
Champion II

@bunty_rsr ,you need to design the job below way and the key should be a check on cust_id. in the schema of tdbioutput.

0683p000009Ma9N.png

Anonymous
Not applicable
Author

@manodwhb Thank you. We can do it this way. 

 

But is there a way that we can use sql query as I asked in my original post using tdbrow component? 

David_Beaty
Specialist
Specialist

Hi,

 

You can, but it would be incredibly inefficient. you need to structure the job something like:

tFileInput Delimited -> tFlowToIterate -> tDBRow

Your tDBRow component will need to reference the globalMap variables create between the file input and flow to iterate.