Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop, mail # dev - [jira] [Created] (SQOOP-1284) Maximal id query for incremental import does not quote table name


Copy link to this message
-
[jira] [Created] (SQOOP-1284) Maximal id query for incremental import does not quote table name
"Knut Nordin 2014-02-07, 12:55
Knut Nordin created SQOOP-1284:

             Summary: Maximal id query for incremental import does not quote table name
                 Key: SQOOP-1284
                 URL: https://issues.apache.org/jira/browse/SQOOP-1284
             Project: Sqoop
          Issue Type: Bug
    Affects Versions: 1.4.4
            Reporter: Knut Nordin
Running an incremental import job where the table name is a reserved word fails. See example and stack trace below:

sqoop job \
 --create order_test \
 -- import \
  --connect jdbc:mysql://server/mydata \
  --username ***** \
  --password ***** \
  --table order \
  --target-dir /user/username/mydata/order_test \
  --incremental append \
  --check-column Id

sqoop job --exec order_test

14/02/07 08:15:45 INFO tool.ImportTool: Maximal id query for free form incremental import: SELECT MAX(`Id`) FROM order
14/02/07 08:15:45 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: 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 'order' at line 1
        at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:282)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:404)
        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:502)
        at org.apache.sqoop.tool.JobTool.execJob(JobTool.java:228)
        at org.apache.sqoop.tool.JobTool.run(JobTool.java:283)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:222)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:231)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:240)
Caused by: 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 'order' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2569)
        at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1524)
        at org.apache.sqoop.tool.ImportTool.getMaxColumnId(ImportTool.java:198)
        at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:269)
        ... 10 more

14/02/07 08:15:45 DEBUG hsqldb.HsqldbJobStorage: Flushing current transaction
14/02/07 08:15:45 DEBUG hsqldb.HsqldbJobStorage: Closing connection

This message was sent by Atlassian JIRA
(v6.1.5#6160)