导入与导出数据

GreenPlum 不用手动输入密码

PGPASSWORD=xxxx   psql -hxxx -Uxxxx -p5432 -d gp_sydb -c "copy  tablename stdout with delimiter ',' " > filepath

 

hive

命令行使用sqoop  export导出数据

sudo -u hdfs sqoop export --connect "jdbc:mysql://ip:port/database?useUnicode=true&characterEncoding=utf8" --username username--password pwd --table tablename --export-dir /user/hive/warehouse/database.db/table  --fields-terminated-by "\001" --lines-terminated-by '\n'  --input-null-string "\\\N" --input-null-non-string "\\\N" 

 

导入数据import

import --connect "jdbc:mysql://ip:port/database?useUnicode=true&characterEncoding=utf8" --username username--password pwd --table tablename --target-dir /user/hive/table  / --delete-target-dir --fields-terminated-by "\001" --hive-drop-import-delims --hive-import --hive-overwrite --hive-database  database

posted @ 2023-07-05 11:43  飞扬92  阅读(10)  评论(0编辑  收藏  举报