Hive如何执行文件中的sql语句
Hive可以运行保存在文件里面的语句,只要用-f参数。
create_table.sh脚本如下:
#!/bin/bash
hive -f /opt/schedule/schedule-deploy/gfkafka_to_hive/gfrobot/hive/create_table.sql
create_table.sql 脚本如下:
use odata_rob;
create table if not exists gfrobot_login(
uri string comment '所请求的服务地址',
) partitioned by (date string)
stored as orc;
insert into table gfrobot_login partition(date)
select *from login_temp;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29050044/viewspace-2137382/ ,如需转载,请注明出处,否则将追究法律责任。