How to generate SQL Queries/orders

One Star

How to generate SQL Queries/orders

Hello all,
is it possible to generate SQL queries according to a configured database without executing them ?
The "bulk" method with loading a csv file doesn't match with my need.
I'm working with the release 4.2.2 of TOS.
Thanks in advance.
Nestor.
Community Manager

Re: How to generate SQL Queries/orders

Hi
What does the query look like would you like to generate?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to generate SQL Queries/orders

Hi,
like that : "insert into tables(id, field1, field2..) values (1,"blabal", "blabla2"...)
and update queries.
Thanks.

Re: How to generate SQL Queries/orders

Not sure why you would want to do this. What problem are you trying to solve? Why do you need to create the insert statements yourself?
With that said, I think you should reconsider why you are attempting to do this.
But, in the case that you really need to here's a possible design:
input-->tJavaRow-->tDBRow
in the JavaRow, create your insert statement and assign it to a context parameter:
context.insert = "INSERT INTO TABLES(id,field1,field2) VALUES (" + input_row.id + "," + input_row.field1 + "," + input_row.field2 + ")"

Then in the DBRow component, put the context variable for your query string:
context.insert
One Star

Re: How to generate SQL Queries/orders

I don't have any technical problem to solve : it's just a "politic one" !
I don't want to manage SQL queries or to play "my queries", just to be able to get queries which are executed on the DB.
The aim is to generate an SQL script with the staging DB and to play this script on the productive environment. I repeat, it's just a politic question and I don't have any other choice.
In my mind, it should be very simple and should be provided by the tool as it's a powerfull way to check what it is doing with the DB.
I'm afraid to understand that this feature is not embeded...
Thanks for your help.
One Star

Re: How to generate SQL Queries/orders

I have a little more complicated problem. I need to generate INSERT or UPDATE statements based on the data exists in the database. I am doing this because I need to execute this file on each client who has their own local database. I needed to maintain the FK integrity and cannot rebuild the table on each client.
Thanks
Ravi Ada