从oracle导入BLOB(Image)到hive

时间:2016-06-08 12:55:16

标签: oracle hadoop hive sqoop

我正在尝试使用以下Sqoop命令将oracle中的BLOB(Image)数据导入Hive。

sqoop import --connect jdbc:oracle:thin:@host --username --password  --m 3 --table tablename  --hive-drop-import-delims  --hive-table tablename --target-dir '' --split-by id;

但不成功。请记住,BLOB数据作为十六进制存储在oracle数据库中,我们需要将其作为文本或双字节存储到Hive表中。

有什么可能的方法呢?

1 个答案:

答案 0 :(得分:1)

Sqoop不知道如何将oracle中的blob数据类型映射到Hive。所以你需要指定--map-column-hive COLUMN_BLOB=binary

sqoop import --connect 'jdbc:oracle:thin:@host' --username $USER --password $Password  --table $TABLE  --hive-import --hive-table $HiveTable  --map-column-hive COL_BLOB=binary --delete-target-dir --target-dir $TargetDir  -m 1 -verbose