【发布时间】:2020-10-14 20:18:01
【问题描述】:
我正在尝试替换 jaydebeapi 与 facebook 的 presto-python-client 问题是如何替换认证位
db = jaydebeapi.connect(connection['jclass'], connection['host'],[ connection['user'], connection['pass']], connection['jar'])
使用 presto-python-client 时
import prestodb
conn= prestodb.dbapi.connect(
host='localhost',
port=8080,
user='the-user',
catalog='the-catalog',
schema='the-schema',
isolation_level=transaction.IsolationLevel.REPEATABLE_READ,
)
我找不到任何地方指定如何传递密码。 此更改的原因是我在尝试使用 jaydebeapi 传递长查询(18k 个字符)时遇到模棱两可的错误
【问题讨论】:
-
你找到答案了吗?
-
@CristhianBoujon 抱歉,现在才看到您的评论 :) 我们最终使用了 SQLAlchemy,因此解决方案来自 sqlalchemy.engine import create_engine engine = create_engine('presto://{0}:{1} @{2}:{3}/hive'.format(connection['user'],connection['pass'],connection['host'],int(connection['port'])), connect_args={'协议': 'https', 'requests_kwargs': {'verify': False}}) db = engine.raw_connection()
标签: python-2.7 presto