Home >Database >Mysql Tutorial >hue 支持hive 查询结果数据导出支持中文编码GBK

hue 支持hive 查询结果数据导出支持中文编码GBK

WBOY
WBOYOriginal
2016-06-07 16:34:533190browse

既然是hive的查询结果那么我们肯定要修改 hue apps里的beeswax/src/beeswax vim data_export.py 在def download(handle, format, db): 上添加代码: EXPORT_CHART_SET='gb2312' 然后修改 def download(handle, format, db) 里面的CSVformatter 和CSVformatte

既然是hive的查询结果那么我们肯定要修改 hue apps里的beeswax/src/beeswax

 vim data_export.py 

在def download(handle, format, db): 上添加代码:

EXPORT_CHART_SET='gb2312'

然后修改 def download(handle, format, db) 里面的CSVformatter 和CSVformatter 增加我们上面定义的变量作为参数。

if format == 'csv':
    formatter = CSVformatter(EXPORT_CHART_SET) #yangqijun.com
    mimetype = 'application/csv'
  elif format == 'xls':
    formatter = CSVformatter(EXPORT_CHART_SET) #yangqijun.com
    mimetype = 'application/xls'

然后重新启动 一下即可

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn