1.使用 presto-client
pip install presto-client==0.302.0
查询
import presto
# demo about the usage of presto-python-client
conn = presto.dbapi.connect(
host='localhost',
port=8889,
user='hadoop',
catalog='xx_catalog',
schema='default'
)
cur = conn.cursor()
sql = "select * from xxx.xxx limit 10"
cur.execute(sql)
rows = cur.fetchall()
print(rows)