Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tMySQLOutput generating invalid SQL statement

Hello !
I have this on a Talend job :

0683p000009MHBC.png

The aim is to fill the table with data, the table is just a relational one (2 fields which correspond to ID of other tables)
The tJava component allows me to print the query
It contains :

System.out.println(((String)globalMap.get("tMysqlOutput_27_QUERY")));



The tMySQLOutput component is set with "Insert or update on duplicate key or unique index".


The problem is that it gives me an SQL Syntax Error.
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 '' at line 1

With the tJava component, I get the query :

INSERT IGNORE INTO `myTable` (`myField_1`,`myField_2`) VALUES (36,12766) ON DUPLICATE KEY UPDATE


In facts, this query is invalid (using MySQL 5.7)

It works with "Insert or update" mode.


Then, is it a bug/mistake from Talend ?
Or do I have misunderstood the way of using "Insert or update on duplicate key or unique index" ?

Thank you for your answers !

Anth224

Labels (2)
2 Replies
Anonymous
Not applicable
Author

I don't see what is invalid about that statement, apart from the missing UPDATE logic. This is likely to do with the component not having been configured correctly.
You need to give us more information. Have you configured the "Field Options" in the Advanced Tab? What is the actual error message?
Anonymous
Not applicable
Author

Hi,
You are right, I didn't configured it at all through the other tabs.
I thought it will update the data using the columns I put as key, like it does through 'Insert or Update' mode.

By the way, the error message was just : '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 '' at line 1'
Thank you!