首页 > 编程知识 正文

python连接sqlserver并写入数据,python连接mysql移动数据

时间:2023-05-03 17:46:34 阅读:196839 作者:3106

一、linux 安装hive

linux 环境,Anaconda3 python3.6

安装方式:pip install pyhive 或是 conda install pyhive

报错1,例如:

ModuleNotFoundError: No module named 'thrift'

ModuleNotFoundError: No module named 'past' (future 包)

ModuleNotFoundError: No module named 'sasl'

ModuleNotFoundError: No module named 'thrift_sasl'

解决方法:若无法直接conda install , 到anaconda官网,搜索需要的包: https://anaconda.org/anaconda/,

例如: 搜索 pyhive, 下载对应python版本的压缩包pyhive-0.6.0-py36_0.tar.bz2,

然后 conda install pyhive-0.6.0-py36_0.tar.bz2,完成。

报错2:ImportError: libsasl2.so.3: cannot open shared object file: No such file or directory

解决方法:ln -s /usr/lib64/libsasl2.so /usr/lib64/libsasl2.so.3

二、python 连接hive from pyhive import hiveconn = hive.Connection(host="XXX", port='XXX', username='XXX',password='XXX',database='XXX',auth="LDAP") cursor = conn .cursor()cursor.execute("select * from xxx")result = cursor.fetchall()df = pd.DataFrame(list(result))

python连接mysql: https://blog.csdn.net/kerry_55/article/details/105789298

python连接oracle:  https://blog.csdn.net/kerry_55/article/details/93390592

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。