0

I am trying to use python to connect to impala for query and my code is as follows:

from impala.dbapi import connect
import pandas as pd

conn = connect(host="xxx.xxx.xxx.xxx", port=10000, auth_mechanism="PLAIN", user="admin",
               password="admin")
cur = conn.cursor()

sql = """
SELECT * from my_table WHERE (att='xxx')
and (budat BETWEEN '2000-01-01' and '2023-01-01')  ORDER BY aaa asc 
"""

cur.excute(sql)
cur.close()
res = cur.fetchall()
df = pd.DataFrame(data=res)
df.to_csv('impalatest.csv', encoding='utf-8', index_label='idx')

The impyla version I am using is 0.18.0. And I got the error as below:

thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

I want to know how to solve this problem.

0 Answers0