embulk / embulk-output-jdbc

MySQL, PostgreSQL, Redshift and generic JDBC output plugins for Embulk
Other
88 stars 86 forks source link

cannot an insert statement after executing an update statement with after_load of embulk, #298

Closed koichi-oshima closed 3 years ago

koichi-oshima commented 3 years ago

I want to execute an insert statement after executing an update statement with after_load of embulk, but the following code causes a syntax error.

If you know how to do it, please let me know.

Code

{% include'input'%}
  table: tableA
{% include'output'%}
  table: tableA
  after_load: update XX;
              insert XX;

Error

Error: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near'update XXX' at line 1
hiroyuki-sato commented 3 years ago

As I commented before, I recommend you to use a Stored Procedure. IIUC, after_load doesn't support multiple SQL statements.

koichi-oshima commented 3 years ago

thank you for your answer. Sorry for the lack of confirmation.