我想通過mysql數據庫中的sqoop將數據加載到配置單元中已有的表中。我參考了以下指南以供參考: - http://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html#_importing_data_into_hive如何使用sqoop覆蓋配置單元中的數據
--hive-import
已成功嘗試並通過測試。
我創建了一個蜂巢表如下: -
create table sqoophive (id int, name string, location string) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;
加載的數據根據需要。
我想用
--hive-overwrite
選項覆蓋上表中的內容。根據上述指導 - 「--hive-overwrite覆蓋Hive表中的現有數據。」
「如果Hive表已經存在,則可以指定--hive-overwrite選項來指示必須替換配置單元中的現有表。」
所以,我想下面的查詢分別得出結果: -
sqoop import --connect jdbc:mysql://localhost/test --username root --password 'hr' --table sample --hive-import --hive-overwrite --hive-table sqoophive -m 1 --fields-terminated-by '\t' --lines-terminated-by '\n'
sqoop import --connect jdbc:mysql://localhost/test --username root --password 'hr' --table sample --hive-overwrite --hive-table sqoophive -m 1 --fields-terminated-by '\t' --lines-terminated-by '\n'
而不是在現有的表更換內容,它只是在下面的路徑中創建的文件/user/<username>/<mysqltablename>
請問有人能解釋我哪裏出錯了嗎?