thriftpy2.protocol.exc.TProtocolException: No protocol version header
以上错误按照下方的代码例子可以解决
a
u
t
h
m
e
c
h
a
n
i
s
m
=
′
P
L
A
I
N
′
auth_mechanism='PLAIN'
authmechanism=′PLAIN′
from impala.dbapi import connect
conn=connect(host='hadoop03'
,port=10000
,user='root'
,password='123456'
,database='test'
,auth_mechanism='PLAIN'
)
cur=conn.cursor()
cur.execute('show tables')
data = cur.fetchall()
for i in data:
print(i)
import pymysql
db=pymysql.connect('localhost','root','123456','test',charset='utf8')
cursor = db.cursor()
cursor.execute('select * from a')
data=cursor.fetchall()
for i in data :
print(i)
db.close()