pyhive:使用pyhive设置配置单元属性

zlwx9yxi  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(652)

我有一个复杂的配置单元查询,它的底层连接是笛卡尔积。所以我需要设置以下属性。但是当我使用pyhive执行这些属性时,它无法执行。我要求设置笛卡尔函数的属性时出错。
set1=''设置hive.strict.checks.cartesian.product=false''
set2=''设置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)
b1payxdu

b1payxdu1#

尝试如下设置:

hive.connect('host', configuration={'hive.strict.checks.cartesian.product':'false'})
hive.connect('host', configuration={'hive.mapred.mode':'strict'})

相关问题