Hive和Hdinsight与Azure上的python的连接性

问题描述 投票:0回答:1

我想使用python脚本将hive与hdinsight群集连接,但由于访问问题而无法访问群集仪表板,这将为我提供JDBC URL信息,有助于与hive建立连接。

[谁能在python的帮助下帮助/推荐我将hive与hdinsight集群连接的方法。

import jaydebeapi
conn = jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver",
       "jdbc:hive2://16.4.5.492:451/default/;ssl=true;transportMode=http;httpPath=/hive2", 
       ['Username', 'Password'],
       ["/jdbc/hive-jdbc-1.2.1-standalone.jar",
        "/jdbc/httpclient-4.4.jar",
        "/jdbc/httpcore-4.4.4.jar"])
python azure hadoop hive hdinsight
1个回答
0
投票
WebHCat是HCatalog的REST API,表和Apache Hadoop的存储管理层。 WebHCat is enabled by default on HDInsight clusters,并且被各种工具用来提交作业,获取作业状态等,而无需登录集群。因此,简而言之,您可以使用WebHCat在Python中运行Hive QL。

附加参考:

https://cwiki.apache.org/confluence/display/Hive/WebHCathttps://social.msdn.microsoft.com/Forums/en-US/b8026143-975f-46c9-b937-99f604e3b757/connect-to-hive-in-hdinsight-using-python-app-on-remote-linuxbased-server?forum=hdinsight

此外,您可以参考以下文档以使其与JDBC驱动程序一起使用:

https://github.com/uglide/azure-content/blob/master/articles/hdinsight/hdinsight-connect-hive-jdbc-driver.md

我还没有尝试过,但是一旦配置完成,您应该可以使用以下代码进行查询。

import jaydebeapi conn = jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver", "jdbc:hive2://my_ip_or_url:443/;ssl=true;transportMode=http;httpPath=/hive2", [username, password], "/jdbc/hive-jdbc-1.2.1.jar")

希望有帮助。
© www.soinside.com 2019 - 2024. All rights reserved.