One Star

How to pass a parmeter value into MySQL query within Talend

I just started working with Talend and I have a basic question regarding passing parameters into a MySQL query within Open Studio. I have a basic ETL process that I wanted to parameterize the MONTH_ID and attempt to pass in a month id to process one month at a time.
For Example: (200801 would be the value I would want to parameterize.
SELECT Col1, col2, col3
FROM MySQL.Table
WHERE MONTH_ID = 200801

Questions:
1. From reading the forum it sounds like I need to use a context variable, but I am finding mix results on the syntax of passing it in the SQL. If it is a numeric do I just supply the context variable like - + context.month_id +
2. How do I supply the new value at run time. 200801, 200802, 200803,...201009?? Will I be prompted?

Thanks in advance - Mike D
1 REPLY
One Star

Re: How to pass a parmeter value into MySQL query within Talend

The syntax in the query field can either be a literal, quoted string eg "SELECT ID, NAME FROM CUSTOMER" or any expression like "SELECT ID,NAME FROM CUSTOMER WHERE COUNTRY='" + context.CountryCode = "'"
In the context editor you can define default values and prompts for any context variable
T