Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

Five Stars

Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

I dragged a DB table from my Metadata tree onto my canvas and created a MySQL DB Input. The default SQL query pulls all the records in the table. I modified the query by adding a WHERE clause at the end to only retrieve certain records that I need to update.

 

whereClause.PNG

 

Now I cannot get my job to compile because of a syntax error in my code. When I switch from the Designer mode to the Code mode I can see that my addition is not being correctly incorporated into the query string. My additional line is not being wrapped in quotes and appended with a '+' operator as it should be. I am unable to edit the code side directly and nothing I do on the Designer side is resulting in correct code. What am I missing here?

 

noQuotes.PNG

Seventeen Stars

Re: Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

This is strange and for sure not your fault.

Actually I do not use this feature, instead I ALWAYS design my queries outside Talend in a real SQL tool like DBeaver and check the query always with a explain plan to avoid long running queries.

Next I am usually never happy with the way, Talend Studio creates select SQL statements, because of the always full qualified identifier which blows up the SQL code.

Five Stars

Re: Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

There's nothing wrong with my query, just that the tool is failing to incorporate my query correctly. Is there an alternative method you use?

Five Stars

Re: Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

When I try to change the SQL back to the original statement by deleting my WHERE clause, the code window no longer updates to reflect my changes. It keeps my line there with the compilation error. Can someone please explain to me how and when the underlying code is synced with changes made on the Designer side?

Five Stars

Re: Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

I have tried deleting the tDBInput element altogether and recreating it...twice now. The name of my input is tDBInput_3. When I go to the Code view, the errors in my code are variables referencing tDBInput_1, which no longer exists. Why isn't my code updating to match the designer window? How can I force a regeneration of the underlying java code?

Six Stars

Re: Editing tMySQLInput SQL query in Designer mode generates bad Code syntax

Have you tried typing the query without newline?