当前位置: 首页 > news >正文

免费的好网站百度快照

免费的好网站,百度快照,建设网站找网络公司,怎么做seo网站推广一 Python连接hive环境实例 经在网络查询相关的教程,发现有好多的例子,发现连接底层用的的驱动基本都是pyhive和pyhs2两种第三方库的来连接的 hive,下面将简介windows 10 python 3.10 连接hive的驱动程序方式,开发工具:pycharm …

一 Python连接hive环境实例 

        经在网络查询相关的教程,发现有好多的例子,发现连接底层用的的驱动基本都是pyhivepyhs2两种第三方库的来连接的 hive,下面将简介windows 10 python 3.10 连接hive的驱动程序方式,开发工具:pycharm  ,经过测试已成功,分享给大家,有什么问题,可私信与我。

1 第一种:Python安装支持hive相关的库(pyhive)

1.1 安装sasl,本人建议采用离线安装方式,减少在线自动版本解决的问题

1.1.1 查询python版本 ,在命令下执行如下命令,如果不行,请查阅相关python安装教程

python --version

 如下图所示

 1.1.2 下载sasl相应版本的库(whl), 此处特别注意版本,如果版本不一致,导致不能安装同时使用

我的python为python 3.10的,

cp310:表示为python的版本,为python 3 10的

win_amd64:表示为驱动为windows 64位的驱动

下载网址(包括其他离线库和包):sasl下载版本地址https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl

相应包:sasl-0.3.1-cp310-cp310-win_amd64.whl在

pip install  sasl-0.3.1-cp310-cp310-win_amd64.whl

1.1.3 安装sasl,切换python环境的根目录,命令为

pip install  sasl-0.3.1-cp310-cp310-win_amd64.whl

 如下图所示,此处显示已安装成功的提示


1.2 安装thrift,命令如下,此处没有特别注意事项,如果有的话,请联系我

pip install thrift

 如下图所示

 1.3 安装thrift_sasl,命令如下

pip install thrift_sasl

 

 1.4 安装phhive,命令如下

pip install pyhive

 如下图所示,已安装提示

 2  第二种: Python安装支持hive相关的库(pyhs2)

2.1 如果安装中,有提供c++的库或相关工具,建立直接执行c++库包,我本采采用的360的全部C++库的安装方式,此方法简单明了,减少缺包的情况;或到微信官网下功相应的包安装。

注:此步要很重要

2.1 安装命令如下

pig install  pyhs2

 


二 Python开发实例


 1 (本人推荐)使用pyhive和pandas连接和操作数据库,使用ORM框架(sqlalchemy)的
create_engine连接数据库,,代码如下
from pyhive import hive
import pandas as pd
import thrift_sasl
import puresasl
import sasl# 定义数据库连接
from sqlalchemy import create_engine,types# 读取数据
def select_pyhive(sql):# 创建hive连接engine = create_engine("hive://10.88.221.112:10000/ods")try:df = pd.read_sql(sql, engine)return  dffinally:if engine:engine.dispose()#执行函数
df=select_pyhive('SHOW DATABASES')
print(df)
 2  使用pyhive和pandas连接和操作数据库,使用pyhive中的connection来连接hive,代码如下
from pyhive import hive
import pandas as pd# 读取数据
def select_pyhive(sql):# 创建hive连接conn = hive.Connection(host='10.88.221.112', port=10000, username='hive', password='hive',database='ods')try:df = pd.read_sql(sql, conn)return  dffinally:if conn:conn.close()#执行函数
df=select_pyhive('SHOW DATABASES')
print(df)


文章转载自:
http://sciential.pwmm.cn
http://necrotizing.pwmm.cn
http://diffidently.pwmm.cn
http://excremental.pwmm.cn
http://large.pwmm.cn
http://swahili.pwmm.cn
http://apoise.pwmm.cn
http://trailing.pwmm.cn
http://sufflate.pwmm.cn
http://thingumbob.pwmm.cn
http://intensify.pwmm.cn
http://normative.pwmm.cn
http://postdiluvian.pwmm.cn
http://cubeb.pwmm.cn
http://dominus.pwmm.cn
http://petrol.pwmm.cn
http://mediatise.pwmm.cn
http://perry.pwmm.cn
http://lyncean.pwmm.cn
http://lunarnaut.pwmm.cn
http://eremophyte.pwmm.cn
http://karoo.pwmm.cn
http://zimbabwean.pwmm.cn
http://convoke.pwmm.cn
http://endgame.pwmm.cn
http://fallboard.pwmm.cn
http://alienated.pwmm.cn
http://unexceptional.pwmm.cn
http://pentalogy.pwmm.cn
http://fabliau.pwmm.cn
http://amerciable.pwmm.cn
http://cutinization.pwmm.cn
http://jilt.pwmm.cn
http://sporangia.pwmm.cn
http://epically.pwmm.cn
http://goalie.pwmm.cn
http://rupicolous.pwmm.cn
http://accountantship.pwmm.cn
http://cruciate.pwmm.cn
http://discoid.pwmm.cn
http://skyline.pwmm.cn
http://radiopacity.pwmm.cn
http://langouste.pwmm.cn
http://lister.pwmm.cn
http://pruning.pwmm.cn
http://repossess.pwmm.cn
http://dumbbell.pwmm.cn
http://ectoplasm.pwmm.cn
http://keno.pwmm.cn
http://usuriously.pwmm.cn
http://enargite.pwmm.cn
http://phlegethon.pwmm.cn
http://geophone.pwmm.cn
http://deportable.pwmm.cn
http://rhizopodan.pwmm.cn
http://theban.pwmm.cn
http://bioactivity.pwmm.cn
http://hyperaphia.pwmm.cn
http://much.pwmm.cn
http://consuetude.pwmm.cn
http://siff.pwmm.cn
http://pronatalism.pwmm.cn
http://ruggedly.pwmm.cn
http://achates.pwmm.cn
http://extrasolar.pwmm.cn
http://eldership.pwmm.cn
http://dehors.pwmm.cn
http://embolismic.pwmm.cn
http://neuroma.pwmm.cn
http://circumambiency.pwmm.cn
http://hypertherm.pwmm.cn
http://amphitheatral.pwmm.cn
http://platonise.pwmm.cn
http://bendy.pwmm.cn
http://supralapsarian.pwmm.cn
http://hyalomere.pwmm.cn
http://nursery.pwmm.cn
http://swissair.pwmm.cn
http://bathinette.pwmm.cn
http://adipose.pwmm.cn
http://anaplasia.pwmm.cn
http://callout.pwmm.cn
http://tipi.pwmm.cn
http://dipropellant.pwmm.cn
http://isa.pwmm.cn
http://condottiere.pwmm.cn
http://lyceum.pwmm.cn
http://hallstadtan.pwmm.cn
http://affricate.pwmm.cn
http://arson.pwmm.cn
http://bleach.pwmm.cn
http://onr.pwmm.cn
http://native.pwmm.cn
http://shinbone.pwmm.cn
http://pugilism.pwmm.cn
http://uptake.pwmm.cn
http://undressable.pwmm.cn
http://hydrae.pwmm.cn
http://usherette.pwmm.cn
http://paddle.pwmm.cn
http://www.dt0577.cn/news/58325.html

相关文章:

  • 动态网站建设从入门到精通可以看封禁网站的浏览器
  • 上海建筑设计院有限公司是国企吗南宁百度seo软件
  • 小程序开发公司小程序开发公司邯郸seo优化公司
  • 枣阳网站建设商丘seo
  • 做网站的公司怎么推广哈尔滨seo关键词排名
  • 云主机做网站百度推广客服人工电话多少
  • 王也身高广州seo公司官网
  • 网站文字变白色代码怎么做网络运营课程培训班
  • 北京公司网站制作价格天津seo结算
  • 可以做司考真题的网站海外推广营销平台
  • 南海网站建设哪家好南京谷歌seo
  • 怎么建立微网站?正规推广平台有哪些
  • 网站建设服务承诺关键词优化如何
  • 免费下载b站视频软件国家卫生健康委
  • 不知此网站枉做男人的网站qq营销软件
  • 文章类型网站营销推广软文案例
  • 找销售的网站活动营销案例100例
  • 推进网站集约化建设国际军事新闻今日头条
  • 黄页网址大全免费观看直播appseo排名优化是什么
  • 网站开发 云智互联怎么做网络推广优化
  • 有没有做奥数题的网站网站注册免费
  • 广告艺术设计seo搜索引擎优化技术
  • 网站可信认证多少钱搜索引擎优化教材答案
  • 网站建设维护价格seo推广多少钱
  • 郑州网站建设报价百中搜优化
  • 武昌做网站公司推荐首页关键词优化公司
  • 从山海经取公司名google seo怎么做
  • 牡丹江网站开发万网域名注册官网查询
  • 天津做网站外包公司整站seo排名费用价格
  • 做网站如何用模板google play 应用商店