Hive client for Python 3.x

2019-06-23 18:11发布

问题:

is it possible to connect to hadoop and run hive queries using Python 3.x? I am using Python 3.4.1.

I found out that it can be done as written here: https://cwiki.apache.org/confluence/display/Hive/HiveClient#HiveClient-Python

However, I cannot install hive module because it says that 'Could not find a version that satisfies the requirement hive'.

回答1:

If you have HiveServer2 installed you can use pyhs2. Or if you're execution your script locally, than you can use subprocess and catch the output of hive -e your_query;.