2

I want to update a column enum_value of tableB with the values of another column enum_value in tableA using MySQL update query as follows:

UPDATE tableB t1 
INNER JOIN TableA t2 ON t1.sig_name = t2.sig_name
SET t1.enum_value = t2.enum_value
WHERE t1.dbc_Version = t2.dbc_version

The above SQL query runs fine in the MYSQL workbench, but I want to execute this query (perform this Update dynamically using NiFi PUTSQL (SQL Statement) property. When I write this in NiFi PutSQL, I get an error. I have attached the screenshots below:

ConvertJsonTOSQL

PUTSQL SQLstatement

PUTSQL Error

Is there I way I can achieve dynamic(on the fly update in the DB) using NiFi? If yes, Then how and what controller services needThanks in advance! to be set?

Thanks in advance!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Shrads
  • 883
  • 19
  • 39

1 Answers1

1

If you have the query directly in PutSQL, what is the purpose of the ConvertJSONToSQL processor right before that? That processor generates attributes from the JSON data, which PutSQL looks for when trying to populate a prepared statement with parameters (which you don't have as you're using an explicit statement with no ?s).

See this SO post for more information, basically you should use UpdateAttribute to remove any attributes created by ConvertJSONToSQL.

mattyb
  • 11,693
  • 15
  • 20