4.数据入库
text3_1表入库
#1.添加驱动
add jar /usr/local/hive/lib/hive-contrib-3.1.2.jar
add jar /usr/local/hive/lib/mysql-connector-java-8.0.26.jar
#2.创建临时函数
CREATE TEMPORARY FUNCTION dboutput AS 'org.apache.hadoop.hive.contrib.genericudf.example.GenericUDFDBOutput'
select dboutput('jdbc:mysql://192.168.189.131:3306/hive?useSSL=false','root','123456','INSERT INTO text3_1(day_id, sale_nbr, cnt, round) VALUES (?, ?, ?, ?)',day_id, sale_nbr, cnt, round) from text3_1
text3_2表入库
#1.添加驱动
add jar /usr/local/hive/lib/hive-contrib-3.1.2.jar
add jar /usr/local/hive/lib/mysql-connector-java-8.0.26.jar
#2.创建临时函数
CREATE TEMPORARY FUNCTION dboutput AS 'org.apache.hadoop.hive.contrib.genericudf.example.GenericUDFDBOutput'
select dboutput('jdbc:mysql://192.168.189.131:3306/hive?useSSL=false','root','123456','INSERT INTO text3_2(day_id, sale_nbr, cnt, round) VALUES (?, ?, ?, ?)',day_id, sale_nbr, cnt, round) from text3_2
text3_3表入库
#1.添加驱动
add jar /usr/local/hive/lib/hive-contrib-3.1.2.jar
add jar /usr/local/hive/lib/mysql-connector-java-8.0.26.jar
#2.创建临时函数
CREATE TEMPORARY FUNCTION dboutput AS 'org.apache.hadoop.hive.contrib.genericudf.example.GenericUDFDBOutput'
select dboutput('jdbc:mysql://192.168.189.131:3306/hive?useSSL=false','root','123456','INSERT INTO text3_3(day_id, sale_nbr, cnt, round) VALUES (?, ?, ?, ?)',day_id, sale_nbr, cnt, round) from text3_3
5.数据可视化展示