set1 = '''SET hive.strict.checks.cartesian.product = false'''
set2 = '''SET hive.mapred.mode = strict'''
def connectData(query,host,port,username):
conn = hive.Connection(host=host, port=port, username=username).cursor()
conn.execute(query)
val=conn.fetchall()
columnNames = [a[0] for a in conn.description]
df=pd.DataFrame(data=val,columns=columnNames)
return df
def settings(query,host,port,username):
conn = hive.Connection(host=host, port=port, username=username).cursor()
conn.execute(query)
settings(set1, host, port, username)
settings(set2, host, port, username)
df = connectData(query, host, port, username)
print(df)
答案 0 :(得分:0)
尝试如下所示的设置:
hive.connect('host', configuration={'hive.strict.checks.cartesian.product':'false'})
hive.connect('host', configuration={'hive.mapred.mode':'strict'})