Import BLOB (Image) from oracle to hive

2019-02-20 21:45发布

I am trying to import BLOB(Image)data form oracle to Hive using below Sqoop command.

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;

But unsuccessful. Remember, BLOB Data stored in oracle database as Hexadecimal and we need to store this to Hive table as text or bianary.

What are the possible way to do that?

1条回答
戒情不戒烟
2楼-- · 2019-02-20 21:59

Sqoop does not know how to map blob datatype in oracle into Hive. So You need to specify --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
查看更多
登录 后发表回答