Parameterized queries, how to do them.

I have been working with Talend 5.4.x for about 3 weeks now, awesome tool.
I have the need to execute a query that will return to me a result set of rows containing (person id, person name, person address, person invoice) for several hundred row per week.
I would like to then use the data from the result set in "where" clauses of 12 additional queries in order to create 12 data files for a customer.
I am use to using parameterized queries where a "?" is used as a place holder for a prepared select statement.
How do I accomplish something similar to parameterized queries in Talend? At a minimum I figure each of the 12 data file queries would be a subjob.
Thoughts?
Thanks
Peter
7 REPLIES
Moderator

Re: Parameterized queries, how to do them.

Hi,
From your requirement, please check the component TalendHelpCenter:tMysqlRow with related scenario.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Parameterized queries, how to do them.

Dear Peter,
If I'm not wrong you want to use the results of your main query as a sub query resultset / condition to your 12 additional queries?
Why don't you use tMap and try joining your main query and to these 12 different queries?
You can also store your main query result in tHashMap (input and output) components, kind of temporary table.
Parameterised query is possible assigning variables to your query component, so if you are talking about 100 rows from your main query, then you are bound to iterate 100 times to get your result?
Hope this helps.
G

Re: Parameterized queries, how to do them.

you could also:
tMysqlRow
-> tFlowToIterate
-> tMysqlRow (with parameter from 1st query)
-> tOutputFile***

Re: Parameterized queries, how to do them.

Dear Peter,
If I'm not wrong you want to use the results of your main query as a sub query resultset / condition to your 12 additional queries?
Why don't you use tMap and try joining your main query and to these 12 different queries?
You can also store your main query result in tHashMap (input and output) components, kind of temporary table.
Parameterised query is possible assigning variables to your query component, so if you are talking about 100 rows from your main query, then you are bound to iterate 100 times to get your result?
Hope this helps.
G

G,
I don't disagree with your idea but I am porting the SQL from Pentaho and I would rather let the database crank on the complicated SQL (SQL with outer joins, SQL subselects with outer joins on numerous table etc..).
I have and extensive SQL back round and I would rather let the SQL/Database do the work than try to do manipulations in Talend/Java.
Thanks
Peter

Re: Parameterized queries, how to do them.

Well I have my parameterized parameterized
One Star

Re: Parameterized queries, how to do them.

Hi,
I have a parametrized query to be used for tpostgressqlInput component.Can anyone please help me in this regard.
Moderator

Re: Parameterized queries, how to do them.

Hi Anj,
What does your parametrized query look like?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.