最近在项目中有个需求就是使用sqoop把数据迁移到hive中,以下是我做的一个总结。
数据集描述
Oracle源表(SQOOP_BITCOIN_DS)
Hive目标表(ods_sqoop_bitcoin_ds)
1.创建目标表
手动创建Hive目标表
由于Sqoop导入时自动创建表会自行推断字段类型,可能导致字段类型不准确,所有推荐使用手动创建
Hive目标表的形式来进行目标表创建
create table ods_sqoop_bitcoin_ds(
id int, timestamp_col string, open string, high int, low string, close string, volume_btc string, volume_currency string, weighted_price string
) row format delimited fields terminated by ','
Sqoop导入时建表
执行前需要将Oracle的jdb