关于hive数据库数据导入mysql数据库问题的解决

1、表结构对比

都是字符类型,在我看来么的问题;

2、导入依赖的包试试

将图片中的两个包导入进/hive/lib的路径下:

然后新建临时的dboutput:

CREATE TEMPORARY FUNCTION dboutput AS 'org.apache.hadoop.hive.contrib.genericudf.example.GenericUDFDBOutput';

然后将hive数据表的数据导入到mysql中:

select dboutput('jdbc:mysql://node1:3306/transport?useSSL=false','root','hadoop','INSERT INTO test(day_id,sale_nbr,cnt,round) VALUES (?,?,?,?)',day_id,sale_nbr,cnt,round) from test3_1;

这个是我测试一个csv文件,导入进去了:

开心!激动!

posted @ 2023-09-21 01:57  yesyes1  阅读(79)  评论(0编辑  收藏  举报