<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • python如何連接hive

            這篇文章將為大家詳細(xì)講解有關(guān)python 如何連接hive,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。

            成都創(chuàng)新互聯(lián)公司主要業(yè)務(wù)有網(wǎng)站營(yíng)銷(xiāo)策劃、網(wǎng)站設(shè)計(jì)制作、網(wǎng)站制作、微信公眾號(hào)開(kāi)發(fā)、小程序開(kāi)發(fā)、HTML5建站、程序開(kāi)發(fā)等業(yè)務(wù)。一次合作終身朋友,是我們奉行的宗旨;我們不僅僅把客戶(hù)當(dāng)客戶(hù),還把客戶(hù)視為我們的合作伙伴,在開(kāi)展業(yè)務(wù)的過(guò)程中,公司還積累了豐富的行業(yè)經(jīng)驗(yàn)、全網(wǎng)營(yíng)銷(xiāo)推廣資源和合作伙伴關(guān)系資源,并逐漸建立起規(guī)范的客戶(hù)服務(wù)和保障體系。 

            python連接hive的幾種方式

            ·基于pyhive連接hive。

            ·基于impyla連接hive。

            方法一:使用PyHive庫(kù)

            安裝依賴(lài)包:其中sasl安裝可能會(huì)報(bào)錯(cuò),可以去https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl下載對(duì)應(yīng)版本安裝。

            pip install sasl
            pip install thrift
            pip install thrift-sasl
            pip install PyHive

            Python腳本代碼操作:

            from pyhive import hive   # or import hive
            conn = hive.Connection(host='****', port=****, username='****', database='****')
            cursor.execute(''SELECT * FROM my_awesome_data LIMIT 10'')
            for i in range(****):
                sql = "INSERT INTO **** VALUES ({},'username{}')".format(value, str(username))
                cursor.execute(sql)
              
            # 下面是官網(wǎng)代碼:
            from pyhive import presto  # or import hive
            cursor = presto.connect('localhost').cursor()
            cursor.execute('SELECT * FROM my_awesome_data LIMIT 10')
            print(cursor.fetchone())
            print(cursor.fetchall())

            方法二:使用impyla庫(kù)

            impyla依賴(lài)包:

            pip install six
            pip install bit-array
            pip install thriftpy

            為了支持Hive還需要以下兩個(gè)包:

            pip install sasl
            pip install thrift-sasl

            可在Python PyPI中下載impyla及其依賴(lài)包的源碼

            Python腳本代碼:

            from impala.dbapi import connect 
            conn = connect(host ='****',port = ****)
            cursor = conn.cursor()
            cursor.execute('SELECT * FROM mytable LIMIT 100')
            print cursor.description   # 打印結(jié)果集的schema 
            results = cursor.fetchall()

            關(guān)于python 如何連接hive就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

            本文標(biāo)題:python如何連接hive
            網(wǎng)頁(yè)地址:http://www.jbt999.com/article26/pdgjcg.html

            成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、Google、靜態(tài)網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)公司服務(wù)器托管、云服務(wù)器

            廣告

            聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

            外貿(mào)網(wǎng)站建設(shè)

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 我想看国产操逼强奸毛片 | 日本一区二区三区在线观看 | 操泥马网| 欧美婷婷五月天 | 我爱大香蕉欧美高清无 |