参考地址:http://www.88cto.com/996962/article/details/32652.html html
默认状况下动态分区插入是禁用的,下表是关于动态分区插入的相关配置属性: python
配置参数 shell |
默认值 编程 |
描述 spa |
hive.error.on.empty.partition htm |
false ci |
在动态分区插入产生空结果时是否抛出异常。 cmd |
hive.exec.dynamic.partition it |
false io |
是否容许动态分区插入,若容许则设置为true。 |
hive.exec.dynamic.partition.mode |
strict |
在strict模式 中用户至少指定一个静态分区以防用户不慎覆盖全部分区,在nonstrict模式中全部分区都容许是动态的。 |
实际项目编程案例:
若是设置:
set hive.exec.dynamic.partition.mode=nonstrict; 设置动态分区
set hive.error.on.empty.partition=true; 那么动态分区若是为空,则会报异常。 很是实用~
可使用 python subprocess 模块:
execute_hql 表示你要执行的 hql 语句
例如: cmd_result = subprocess.call(execute_hql, shell=True)
返回值 0 正常,其余值异常。
~ 谢谢分享