python操作hive并且获取查询结果scheam

 

执行hive -e 命令并且获取对应的select查询出来的值及其对应的scheam字段

需要在执行语句中前部添加 set hive.cli.print.header=true; 这个设置,如下语句: hive -e "set hive.cli.print.header=true;use default;select * from students"

这样最后的结果中会返回查询出来的字段值及其对应的scheam

 

源码参考地址:https://github.com/xjh713/hive-get-scheam.git

 

posted @ 2018-10-18 20:59  新际航  阅读(3685)  评论(1编辑  收藏  举报