cancel
Showing results for 
Search instead for 
Did you mean: 

My sql execute snap

rjapala
New Contributor III

image
Am facing this error when am trying to update column data in SQL dynamically please can anyone give me a solution how to update with correct syntax using with expressions or without

21 REPLIES 21

darshthakkar
Valued Contributor

@rjapala: If you’re copy pasting the expression shared by @ddellsperger, you might see an error again.
Please put the double quotes by yourself as copy pasting the quotes throws an error on the snaps.

Even after modifying your query, you see an error, can you please confirm whether the $Error_reason and $Customer_ID is a valid field? We may be overlooking the typos if you have named it differently.

Best Regards,
Darsh

rjapala
New Contributor III

Thank you for your reply @ddellsperger i tried giving quotes as well for string but facing same issue again

@darshthakkar yes the both fields and datatypes are valid but also the same issue am facing

@ddellsperger @darshthakkar one thing when i just validate the pipeline it is not throwing an error when i execute then it is throwing an error

image

darshthakkar
Valued Contributor

This is really odd @rjapala.
Can you please try the following:

  1. Enable the error view on MySQL Execute and try running the pipeline again.
  2. Remove WHERE statement from your query however have a filter snap before My-SQL Execute so that it updates only 1 test record of your choice, please try with this and let us know your findings.

rjapala
New Contributor III

Thank you for suggestion @darshthakkar I have tried with different approach using Pipeline execute snap and i have kept the My sql execute snap in child pipeline it is working successfully now

Thanks for the support @ddellsperger @darshthakkar

Here’s an expression that I’ve been using to shorthand the string concatenation in generating an sql statement

"update my_table set my_field = '\$my_update_field', my_null_field = '\$my_null_field' where my_field = '\$my_condition_field'".replace(/\$\w+/gi, m=> eval(m) ).replace(/'null'/gi, 'null')

image