2017-03-06 105 views
0

我試圖導入數據,並且連接正常。列表表格語法給出了我的數據庫中的所有表格。但是當試圖運行導入查詢時,它給了我例外。sqoop上的Sybase IQ導入錯誤1

Sqoop命令:

sqoop import --connect 'jdbc:sybase:Tds:10.100.0.***:5500/DATABASE=iqprod1' --driver 'com.sybase.jdbc3.jdbc.SybDriver' --username "keswara" --password -p --query "select top 100 * from dw.DM_ADDRESS_ITC \$CONDITIONS" --target-dir "/user/keswara/WT_Address_Itc" --split-by 1 --verbose 

錯誤:

17/03/06 17:07:34 DEBUG manager.SqlManager: Execute getColumnInfoRawQuery : select top 100 * from dw.DM_ADDRESS_ITC (1 = 0) 
17/03/06 17:07:34 DEBUG manager.SqlManager: No connection paramenters specified. Using regular API for making connection. 
17/03/06 17:07:35 DEBUG manager.SqlManager: Using fetchSize for next query: 1000 
17/03/06 17:07:35 INFO manager.SqlManager: Executing SQL statement: select top 100 * from dw.DM_ADDRESS_ITC (1 = 0) 
17/03/06 17:07:35 ERROR manager.SqlManager: Error executing statement: com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -131: Syntax error near '=' on line 1 
com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -131: Syntax error near '=' on line 1 
     at com.sybase.jdbc3.tds.Tds.a(Unknown Source) 
     at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source) 
     at com.sybase.jdbc3.tds.Tds.getResultSetResult(Unknown Source) 
     at com.sybase.jdbc3.tds.TdsCursor.open(Unknown Source) 
     at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source) 
     at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source) 
     at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:758) 
     at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767) 
     at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270) 
     at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241) 
     at org.apache.sqoop.manager.SqlManager.getColumnTypesForQuery(SqlManager.java:234) 
     at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:304) 
     at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1833) 
     at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1645) 
     at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107) 
     at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478) 
     at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:606) 
     at org.apache.sqoop.Sqoop.run(Sqoop.java:143) 
     at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) 
     at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179) 
     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218) 
     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227) 
     at org.apache.sqoop.Sqoop.main(Sqoop.java:236) 
17/03/06 17:07:35 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter 
     at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1651) 
     at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107) 
     at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478) 
     at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:606) 
     at org.apache.sqoop.Sqoop.run(Sqoop.java:143) 
     at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) 
     at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179) 
     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218) 
     at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227) 
     at org.apache.sqoop.Sqoop.main(Sqoop.java:236) 

我已經在這裏錯過了什麼?非常感謝您的幫助!

回答

0

您錯過了where。試試這個:

--query "select top 100 * from dw.DM_ADDRESS_ITC where \$CONDITIONS" 

查看sqoop documentation瞭解更多詳情。

+0

謝謝@dev。這真的很有幫助。 – karthee

+0

@karthee高興地幫忙! –