- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 impyla 和以下代码连接到 impala:
from impala.dbapi import connect
conn = connect(host='host_name.com', port=21050, user='usr', password='pass', use_ssl=True, auth_mechanism='LDAP')
cursor = conn.cursor()
cursor.execute('SHOW DATABASES')
cursor.fetchall()
根据文档,该库需要 0.2.1 版中的 thrift_sasl,但我无法安装它,因为它显示此错误
Collecting thrift_sasl==0.2.1
Using cached https://files.pythonhosted.org/packages/80/36/16dfe92d32df63cc2b7b7be8d0e4a736617b7e52daaa7f83ae386a89d179/thrift_sasl-0.2.1.tar.gz
Collecting sasl>=0.2.1 (from thrift_sasl==0.2.1)
Using cached https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz
Collecting thriftpy (from thrift_sasl==0.2.1)
Using cached https://files.pythonhosted.org/packages/f4/19/cca118cf7d2087310dbc8bd70dc7df0c1320f2652873a93d06d7ba356d4a/thriftpy-0.3.9.tar.gz
Requirement already satisfied: six in c:\users\psowa\appdata\local\programs\python\python36\lib\site-packages (from sasl>=0.2.1->thrift_sasl==0.2.1) (1.12.0)
Requirement already satisfied: ply<4.0,>=3.4 in c:\users\psowa\appdata\local\programs\python\python36\lib\site-packages (from thriftpy->thrift_sasl==0.2.1) (3.11)
Installing collected packages: sasl, thriftpy, thrift-sasl
Running setup.py install for sasl ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\psowa\appdata\local\programs\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-y42wej4x\\sasl\\setup.py'"'"'; __file__='"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-y42wej4x\\sasl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\psowa\AppData\Local\Temp\pip-record-rjwkcc76\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\psowa\AppData\Local\Temp\pip-install-y42wej4x\sasl\
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\sasl
copying sasl\__init__.py -> build\lib.win-amd64-3.6\sasl
running egg_info
writing sasl.egg-info\PKG-INFO
writing dependency_links to sasl.egg-info\dependency_links.txt
writing requirements to sasl.egg-info\requires.txt
writing top-level names to sasl.egg-info\top_level.txt
reading manifest file 'sasl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info\SOURCES.txt'
copying sasl\saslwrapper.cpp -> build\lib.win-amd64-3.6\sasl
copying sasl\saslwrapper.h -> build\lib.win-amd64-3.6\sasl
copying sasl\saslwrapper.pyx -> build\lib.win-amd64-3.6\sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\sasl
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isasl -Ic:\users\psowa\appdata\local\programs\python\python36\include -Ic:\users\psowa\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsasl/saslwrapper.cpp /Fobuild\temp.win-amd64-3.6\Release\sasl/saslwrapper.obj
saslwrapper.cpp
c:\users\psowa\appdata\local\temp\pip-install-y42wej4x\sasl\sasl\saslwrapper.h(22): fatal error C1083: Cannot open include file: 'sasl/sasl.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\psowa\appdata\local\programs\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-y42wej4x\\sasl\\setup.py'"'"'; __file__='"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-y42wej4x\\sasl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\psowa\AppData\Local\Temp\pip-record-rjwkcc76\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
当我安装最新版本的 thrift_sasl jupyter 时出现此错误:
AttributeError: 'TSSLSocket' object has no attribute 'isOpen'
我还尝试使用以下代码通过 pyhive 连接:
from pyhive import hive
host_name = "host_name.com"
port = 10000
user = "usr"
password = "pass"
def hiveconnection(host_name, port, user,password):
conn = hive.Connection(host=host_name, port=port, username=user, password=password, auth='LDAP')
cur = conn.cursor()
cur.execute('SHOW DATABASES')
result = cur.fetchall()
return result
output = hiveconnection(host_name, port, user,password)
print(output)
它希望我安装 sasl,但当我尝试这样做时,它显示:
Collecting sasl
Using cached https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz
Requirement already satisfied: six in c:\users\psowa\appdata\local\programs\python\python36\lib\site-packages (from sasl) (1.12.0)
Installing collected packages: sasl
Running setup.py install for sasl ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\psowa\appdata\local\programs\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-9rn_a9g0\\sasl\\setup.py'"'"'; __file__='"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-9rn_a9g0\\sasl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\psowa\AppData\Local\Temp\pip-record-sedxucba\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\psowa\AppData\Local\Temp\pip-install-9rn_a9g0\sasl\
Complete output (27 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\sasl
copying sasl\__init__.py -> build\lib.win-amd64-3.6\sasl
running egg_info
writing sasl.egg-info\PKG-INFO
writing dependency_links to sasl.egg-info\dependency_links.txt
writing requirements to sasl.egg-info\requires.txt
writing top-level names to sasl.egg-info\top_level.txt
reading manifest file 'sasl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info\SOURCES.txt'
copying sasl\saslwrapper.cpp -> build\lib.win-amd64-3.6\sasl
copying sasl\saslwrapper.h -> build\lib.win-amd64-3.6\sasl
copying sasl\saslwrapper.pyx -> build\lib.win-amd64-3.6\sasl
running build_ext
building 'sasl.saslwrapper' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\sasl
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Isasl -Ic:\users\psowa\appdata\local\programs\python\python36\include -Ic:\users\psowa\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsasl/saslwrapper.cpp /Fobuild\temp.win-amd64-3.6\Release\sasl/saslwrapper.obj
saslwrapper.cpp
c:\users\psowa\appdata\local\temp\pip-install-9rn_a9g0\sasl\sasl\saslwrapper.h(22): fatal error C1083: Cannot open include file: 'sasl/sasl.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\psowa\appdata\local\programs\python\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-9rn_a9g0\\sasl\\setup.py'"'"'; __file__='"'"'C:\\Users\\psowa\\AppData\\Local\\Temp\\pip-install-9rn_a9g0\\sasl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\psowa\AppData\Local\Temp\pip-record-sedxucba\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
有什么想法吗?
最佳答案
在 2.7 版本中使用 python 修复了这个问题。我认为存在兼容性问题。
关于python - 如何使用 impyla 连接到 impala 或使用 pyhive 连接到 hive?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57958290/
我有一个复杂的配置单元查询,其底层连接是笛卡尔积。所以我需要设置以下属性。但是当我使用 pyhive 执行这些属性时,它无法执行。我在要求设置笛卡尔属性时遇到错误。 set1 = '''SET hiv
我遇到了一个异常 similar to this one我正在尝试根据错误本身来处理它。问题是 pyhive.exc.OperationalError 非常通用,它处理从超时到不存在的表的错误,所以我
我想使用 pyhive 将 Python 连接到 hive。我正在使用下面的 python 脚本在我的本地执行。 #!/usr/bin/env python # coding: utf-8 from
我正在使用PyHive访问我的Hive服务器: # Connection parameters hive_host = "server.redecorp.com" hive_port = 10000
我正在尝试从 iPython Notebook 中的 Hive 访问数据。所以我跑 pip3 install PyHive 返回 Requirement already satisfied: PyHi
我想在 zeppelin 中使用 pyhive 连接 presto 现在,我关注 https://github.com/dropbox/PyHive 我使用了连接函数并更正了参数。 %python f
使用 pyhive,是否可以执行多个 hql,例如“CREATE TABLE TABLE1 (ITEM_KEY BIGINT);CREATE TABLE TABLE2 (ITEM_NAME BIGIN
我正在使用 pyhive 与 hive 交互。 SELECT 语句使用下面的代码运行良好。 # Import hive module and connect from pyhive import hi
我正在尝试使用 SqlAlchemy ORM 在 Hive 数据库中创建一个表。我的设置是 Python 3.6,带有 PyHive==0.6.1 和 SQLAlchemy==1.2.11(及其相关依
我已经安装了, pip install thrift pip install PyHive pip install thrift-sasl 和由于 pip install sasl 失败,我下载了 s
我尝试按照此处所述设置配置单元连接:How to Access Hive via Python?使用 hive 。与 python 3.5.2 的连接(安装在 cloudera Linux BDA 上
我想在我们的 kerberized Hadoop 集群上连接到 Hive,然后从已经有自己的 Kerberose 客户端并且可以工作的机器运行一些 hql 查询(显然是哈哈 :)),keytab 已经
我正在尝试使用 impyla 和以下代码连接到 impala: from impala.dbapi import connect conn = connect(host='host_name.com'
我似乎无法让 PyHive 正常工作。百胜报告已安装包 cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 和最新版本。 希望我只是遗漏了一些东西。请帮忙? ---------
我正在使用运行 CentOS v6 的 cloudera 快速启动 vm 版本 5.13。我想在环境中使用 pyhive 并引用下面的链接安装 pyhive 但我无法安装链接中给出的任何库,因为我收到
我是一名优秀的程序员,十分优秀!