cloudera / impyla

Python DB API 2.0 client for Impala and Hive (HiveServer2 protocol)
Apache License 2.0
731 stars 248 forks source link

Window Support? Impyla would hangs forever in Window 10 #416

Open noklam opened 4 years ago

noklam commented 4 years ago

As described in the title. I use this code snippet to connect with impala.

from impala.dbapi import connect
import pandas as pd
import sqlalchemy

def conn():
    return connect(host='host', port=21050, user=username, password=password
engine = sqlalchemy.create_engine('impala://', creator=conn)

sql='my sql statement'
pd.read_sql_query(sql, engine)

The code snippets can run usually for the first 1 or 2 query, but it will hangs forever quite often. I tested it in a notebook/python console, and both suffer from the same issue.

egormartiniuc commented 4 years ago

Looks like issue more for related with thriftpy2 transport protocol, had something similar with thrift_sasl authentication fix it by adding readall from thriftpy2.

noklam commented 4 years ago

@egormartiniuc Sorry I am not familiar with thrift, is there any fix on it?

egormartiniuc commented 4 years ago

There no fix as a library, what you can do is a cheat a bit in the library class TBufferedTransport, as I can see you use NOSASL authentication connection default one. by import from thriftpy2.transport.base import readall and first replace all self._trans.read(X) to readall(self._trans.read, X)