【发布时间】:2017-05-12 06:41:57
【问题描述】:
我正在尝试根据 mysql 表中的记录更新配置单元表。
mysql-table: (table name: delimiter_test)
+---------------+-----------------+
| department_id | department_name |
+---------------+-----------------+
| 2 | Fitness |
| 3 | Footwear |
| 4 | Apparel |
| 5 | Golf |
| 6 | Outdoors |
| 7 | Fan Shop |
| 8 | Test |
+---------------+-----------------+
hive-table (table name: my_test)
2 Fitness
3 Footwear
4 Apparel
5 Golf
6 Outdoors
7 Fan Shop
我正在尝试使用 sqoop,将 mysql 表中的 department_id 8 的最后一条记录导入到 hive 表中,使用 sqoop 中的增量更新。
my-sqoop 命令:
sqoop import --connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" --username xxx --password xxx --table delimiter_test --hive-import --hive-table my_test --split-by department_id --check-column department_id --incremental append --last-value 7
我没有收到任何错误,但是 mysql 表中的部门 ID 为 8 的额外记录没有更新到 hive 表中。
请建议我哪里出错了。
【问题讨论】:
-
命令对我来说似乎不错。您可以在 swoop 命令末尾添加
--verbose以查看扩展日志并查看是否发现任何错误? -
@devツ 我注意到一些奇怪的事情,当我将映射器的数量添加为 10 (--m 10) 时,department_id 为 8 的额外记录在 hive 表中插入了两次,并且--m 6,记录插入正确。
-
hive 表中是否有部门 _id 字符串?分享
--verbose之后的完整日志