Five Stars

Run MySQL query and use the Output as a datasource in tMap

Hello everybody,


I have a general question. I'm new to Talend and searching for a better solution then mine. I'm using the results of an very complex mySQL query as a datasoruce to create a new table (several datasources are involved for the final table). Right know I'm running the query on mysql workbench, store the data in a table and use that table as a Datasource in my talend job. So a detour.... 

It would be better to run the query directly in my talend job. Because right know I have to update my datasource tables first (run the queries inside my workbench) for using them in my talend job. Otherwise the data for the final table aren't up-to-date.

Maybe I overlooked somthing, but I didn't find a solution with google. I know it's possible to run a query with tMysqlRow. I've done it already. But I didn't get any results to use them in tMap. Is there a way with talend?




Eleven Stars

Re: Run MySQL query and use the Output as a datasource in tMap

Just put your query into a tMySQLInput component, make sure your schema aligns with your select clause columns and wrap the whole thing in double quotes (since it will be treated as a Java String before it is sent to MySQL). Your SQL queries can be as complicated as you like in Talend and they will work inside t{DB}Input components.

Rilhia Solutions