2016-08-18 31 views
0

保留關鍵字我有一個表int在MySQL表名作爲Sqoop

create table `int` (c1 varchar(20)); 

insert into `int` values ('some data'); 

我嘗試使用Sqoop將其導入蜂巢:

sqoop import --connect='jdbc:mysql://xxx.xxx.xxx.xxx/classicmodels' --driver com.mysql.jdbc.Driver --username xxx --password xxx --table int --delete-target-dir --target-dir /tmp/test --hive-import --hive-table default.test --hive-drop-import-delims --null-string '\\N' --null-non-string '\\N' --split-by col_date -m 1 --verbose

在內部,它是創造SELECT t.* FROM int AS t WHERE 1=0

錯誤:

16/08/18 13:43:20 ERROR manager.SqlManager: Error executing statement: 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 'int AS t WHERE 1=0' at line 1

這是預期的。

我試過,--table "int",--table `int`--table "`int`"

他們都沒有工作。

有沒有辦法告訴sqoop創建查詢:

SELECT t.* FROM `int` AS t WHERE 1=0


[ ]用來繞過SQL服務器保留字。

在SQL Server --table dbo.[int]爲我工作。

回答

0

提供--table \`int\`。我記得它是這樣工作的。

+0

它不能夠逃脫雙引號,但我需要逃脫**'**所以它的工作。更新您的回答 –

+0

感謝您的檢查 –