sqoop与PG库导入导出数据


导入数据到Hive

sqoop import --connect jdbc:postgresql://172.66.6.666/radar5g4h --username postgres --password 1234 \
--query " select antenna_model,type,theta,gain from wcnos_antenna_beam where \$CONDITIONS " \
--target-dir table1 --delete-target-dir \
--hive-import --hive-database ott --hive-table table1 \
--null-string '\\N' \
--null-non-string '\\N' \
--fields-terminated-by "," \
-m 1

 

导出数据到PG库

sqoop export --connect jdbc:postgresql://172.66.6.666/radar5g4h --username postgres --password 1234 \
--table table1 \
--export-dir /user/hive/warehouse/ott.db/table1 \
--fields-terminated-by ',' \
--m 1 \
--input-null-string '\\N' --input-null-non-string '\\N'

sqoop到导入数据到PG库时,会通过select * from table 来确定表是否存在,如果不存在则抛出错误。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM