impala 和python的交互

版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/vkingnew/article/details/89073581


--前提条件:
# yum -y install python-devel gcc-c++ python-pip python gcc
告警:
The required version of setuptools (>=3.4.4) is not available,
    and can't be installed while this script is running. Please
    install a more recent version first, using
    'easy_install -U setuptools'.
    
    (Currently using setuptools 0.9.8 (/usr/lib/python2.7/site-packages))
-- 报错信息:
 bitarray/_bitarray.c:9:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
--解决办法:
#yum -y install python-devel python
--升级安装pip
pip install --upgrade pip

--升级安装setuptools
pip install --upgrade setuptools

-- 升级之后的版本:
# pip list | grep -i -E 'pip|setuptools'
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
pip                          19.0.3 
setuptools                   41.0.0 

--安装impala:
pip install impyla
 
Collecting impyla
  Using cached https://files.pythonhosted.org/packages/2b/de/3cadc54ca0aac684e03e5f66ae027bd5bf455f9becf9cc81a435b3834889/impyla-0.14.2.2.tar.gz
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from impyla) (1.9.0)
Collecting bitarray (from impyla)
  Using cached https://files.pythonhosted.org/packages/e2/1e/b93636ae36d08d0ee3aec40b08731cc97217c69db9422c0afef6ee32ebd2/bitarray-0.8.3.tar.gz
Requirement already satisfied: thrift<=0.9.3 in /usr/lib/python2.7/site-packages (from impyla) (0.9.3)
Installing collected packages: bitarray, impyla
  Running setup.py install for bitarray ... done
  Running setup.py install for impyla ... done
Successfully installed bitarray-0.8.3 impyla-0.14.2.2

--安装impala cli:

# pip install impalacli
Collecting impalacli
  Using cached https://files.pythonhosted.org/packages/9e/0d/c1d0a57256bafc4609666a23437208f7ccba4e5f54a53c9b099b441e4da8/impalacli-0.1.5.tar.gz
Requirement already satisfied: click in /usr/lib64/python2.7/site-packages (from impalacli) (7.0)
Requirement already satisfied: cli-helpers==1.0.2 in /usr/lib/python2.7/site-packages (from impalacli) (1.0.2)
Requirement already satisfied: docopt==0.6.2 in /usr/lib/python2.7/site-packages (from impalacli) (0.6.2)
Collecting impyla==0.14.1 (from impalacli)
  Using cached https://files.pythonhosted.org/packages/6f/96/92f933cd216f9ff5d7f4ba7e0615a51ad4e3beb31a7de60f7df365378bb9/impyla-0.14.1-py2-none-any.whl
Collecting prompt-toolkit==1.0.15 (from impalacli)
  Using cached https://files.pythonhosted.org/packages/d1/b0/1a6c262da35c779dd79550137aa7c298a424987240a28792ec5ccf48f848/prompt_toolkit-1.0.15-py2-none-any.whl
Collecting Pygments==2.2.0 (from impalacli)
  Using cached https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: terminaltables>=3.0.0 in /usr/lib/python2.7/site-packages (from cli-helpers==1.0.2->impalacli) (3.1.0)
Requirement already satisfied: tabulate[widechars]>=0.8.2 in /usr/lib/python2.7/site-packages (from cli-helpers==1.0.2->impalacli) (0.8.3)
Requirement already satisfied: backports.csv>=1.0.0 in /usr/lib/python2.7/site-packages (from cli-helpers==1.0.2->impalacli) (1.0.7)
Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from impyla==0.14.1->impalacli) (1.9.0)
Requirement already satisfied: thrift<=0.9.3 in /usr/lib/python2.7/site-packages (from impyla==0.14.1->impalacli) (0.9.3)
Requirement already satisfied: bitarray in /usr/lib64/python2.7/site-packages (from impyla==0.14.1->impalacli) (0.8.3)
Requirement already satisfied: wcwidth in /usr/lib/python2.7/site-packages (from prompt-toolkit==1.0.15->impalacli) (0.1.7)
Installing collected packages: impyla, prompt-toolkit, Pygments, impalacli
  Found existing installation: impyla 0.14.2.2
    Uninstalling impyla-0.14.2.2:
      Successfully uninstalled impyla-0.14.2.2
  Running setup.py install for impalacli ... done
Successfully installed Pygments-2.2.0 impalacli-0.1.5 impyla-0.14.1 prompt-toolkit-1.0.15

--核对:
# pip list  | grep -i im
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
impalacli                    0.1.5  
impyla                       0.14.1 

参考:
https://github.com/cloudera/impyla

猜你喜欢

转载自blog.csdn.net/vkingnew/article/details/89073581