2017-08-05 177 views
0

JOIN當我嘗試使用sqoop導入數據Sqoop

sqoop import --connect jdbc:mysql://100.107.57.141/mysql --username test -P --query 'SELECT FirstName, Education, Car_Details FROM emp e JOIN emp_test_new etn on e.id=etn.id) WHERE $CONDITIONS' --split-by id --target-dir /home/join 

我收到以下錯誤導入從MySQL數據庫中的數據:

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 ') WHERE (1 = 0)' at line 1

17/08/05 12:04:25 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: No columns to generate for ClassWriter

+1

什麼是'$ CONDITIONS'? –

+0

如果我在命令提示符下執行,必須提到哪些條件? – DevPerson

回答

0

你缺少(附近JOIN ON條件。

正確sytnatx:

sqoop import --connect jdbc:mysql://100.107.57.141/mysql --username test -P \ 
--query "SELECT e.FirstName, e.Education, e.Car_Details \ 
FROM emp e JOIN emp_test_new etn ON (e.id == etn.id) \ 
WHERE $CONDITIONS' --split-by id --target-dir /home/join