300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > hive表指定分区字段搜索_hive导出分区表到mysql 分区字段值怎么取

hive表指定分区字段搜索_hive导出分区表到mysql 分区字段值怎么取

时间:2023-04-29 19:39:02

相关推荐

hive表指定分区字段搜索_hive导出分区表到mysql 分区字段值怎么取

匿名用户

1级

-07-16 回答

如何用sqoop将hive分区表信息导入到mysql命令

直接导入hive表

sqoop import --connect jdbc:postgresql://ip/db_name--username user_name --table table_name --hive-import -m 5

内部执行实际分三部,1.将数据导入hdfs(可在hdfs上找到相应目录),2.创建hive表名相同的表,3,将hdfs上数据传入hive表中

sqoop根据postgresql表创建hive表

sqoop create-hive-table --connect jdbc:postgresql://ip/db_name --username user_name --table table_name --hive-table hive_table_name( --hive-partition-key partition_name若需要分区则加入分区名称)

导入hive已经创建好的表中

sqoop import --connect jdbc:postgresql://ip/db_name --username user_name --table table_name --hive-import -m 5 --hive-table hive_table_name (--hive-partition-key partition_name --hive-partition-value partititon_value);

使用query导入hive表

sqoop import --connect jdbc:postgresql://ip/db_name --username user_name --query "select ,* from retail_tb_order where \$CONDITIONS" --hive-import -m 5 --hive-table hive_table_name (--hive-partition-key partition_name --hive-partition-value partititon_value);

注意:$CONDITIONS条件必须有,query子句若用双引号,则$CONDITIONS需要使用\转义,若使用单引号,则不需要转义。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。